And Or Syntax (1 Viewer)

Novice1

Registered User.
Local time
Yesterday, 22:02
Joined
Mar 9, 2004
Messages
385
The following If Then statement doesn't work. Am I using the And's and Or's correctly?


If (Me.CurrentSGLIAmt <> "400,000" Or Me.RSN_Increase_Amt <> "9") And Me.UBLCombo = "Married" Then

Me.SpouseLetter = -1

Else

Me.SpouseLetter = 0

End If
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 22:02
Joined
Aug 30, 2003
Messages
36,133
Well, when you use <> rather than =, the logic flips. Everything is either not equal to x or not equal to y. In other words, you want And in there rather than Or.
 

plog

Banishment Pending
Local time
Today, 00:02
Joined
May 11, 2011
Messages
11,668
The following If Then statement doesn't work

There's a difference between working and producing unexpected results. If pbadly's advice didn't help, I suggest you provide us with examples--tell us what the 3 values are then tell us what you expect as a result of that code.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 22:02
Joined
Aug 30, 2003
Messages
36,133
Happy to help!
 

Users who are viewing this thread

Top Bottom