Lee S
Lee S

Reputation: 17

if statement, OR

I am trying to check if a field is not one of two values then show a message.

Can anyone see where i'm going wrong

If  LegalEntity <> "ETL" or "RGB" Then
           Shell.RedoMessage = "Holiday Carry Over and Trading is not enabled for     your Legal Entity. Please click the Cancel button above"
        Exit Sub
End If

Upvotes: 0

Views: 52

Answers (1)

shareef
shareef

Reputation: 9581

If I understand you need to check that the value of LegalEntity is not "ETL" nor "RGB".

Then it shoud be like this:

'if its not equal to ETL and not equal to RG the enter the condition
If LegalEntity <> "ETL" And LegalEntity <> "RGB" Then
    Shell.RedoMessage = "Holiday Carry Over and Trading is not enabled for your Legal Entity. Please click the Cancel button above"
    Exit Sub
End If

Upvotes: 1

Related Questions