AND Statement Not Working

forms_are_nightmares

Registered User.
Local time
Today, 12:55
Joined
Apr 5, 2010
Messages
71
Hello All,

I know I've done this before and am pretty sure I have something small missing from the code. In the below code, only the first part of the IF statement is working, i.e., it evaluates the left of the AND statment and ignores the right. I've switched it round with the same results. The rest of the code works correctly (which is why it's been left out).

Any help would be appreciated.

If Not IsNull(Me.CMgr_cmbo) And Not IsNull(Me.AccountCmbo) Then
DoSomething
Else
DoSomething else
End If
 
Brackets around each condition? Straw clutching....
 
James,

Close. I put () around them and it seems to be working fine now.

Thanks
 
Glad it works, but isn't that what I said? Or do you have to bracket both conditions in one?
 
I realized after I wrote that, there would be a little confusion. Mainly, because I wasn't very clear, sorry.

Yes, I had to put parenthesis around both conditions and it seems to now be reading it as one.
 
Wicked, working if's are all good!
 
double negs are hard

i would probably do it the other way

if isnull(cbo1) OR isnull(cbo2) then ....
 

Users who are viewing this thread

Back
Top Bottom