D
Daniel
Hello,
I previously posted a question about how to check if a value exists in a
combo box. I am using a form to run several queries with one command
button. Depending on if a value exists in the different combo boxes I have
If and Then statements to determine which query is ran. The reply in my
prevously posted question answered the question I was after, however, at the
time I really didn't realize exactly what I needed until now. I need to
know now also if a value is Null or -1 along with >-1 then run query. Here
is what I have.
If Me.combo1.Value > -1 _
And Me.combo2.Value > -1 Then 'This works
<Code to run query1>
ElseIf Me.combo1.Value >-1 _
And Me.combo2.Value = -1 Then 'This should be met if combo2 is blank but
doesn't work
<Code to run query2>
End If
Obviously this is a simple example and my code with be more complex. I
cannot seem to get the 2nd statement to work when combo1 has value and
combo2 doesn't. I understand that if a combo box is blank, then it returns
a -1 value and if there is a value then it is greater than -1. I have tried
combo2 with 0, Null, etc. I must be missing something. Can anyone help?
Thanks,
Daniel
I previously posted a question about how to check if a value exists in a
combo box. I am using a form to run several queries with one command
button. Depending on if a value exists in the different combo boxes I have
If and Then statements to determine which query is ran. The reply in my
prevously posted question answered the question I was after, however, at the
time I really didn't realize exactly what I needed until now. I need to
know now also if a value is Null or -1 along with >-1 then run query. Here
is what I have.
If Me.combo1.Value > -1 _
And Me.combo2.Value > -1 Then 'This works
<Code to run query1>
ElseIf Me.combo1.Value >-1 _
And Me.combo2.Value = -1 Then 'This should be met if combo2 is blank but
doesn't work
<Code to run query2>
End If
Obviously this is a simple example and my code with be more complex. I
cannot seem to get the 2nd statement to work when combo1 has value and
combo2 doesn't. I understand that if a combo box is blank, then it returns
a -1 value and if there is a value then it is greater than -1. I have tried
combo2 with 0, Null, etc. I must be missing something. Can anyone help?
Thanks,
Daniel