DataValidation

newby2VBA

Registered User.
Local time
Today, 12:55
Joined
Feb 6, 2010
Messages
45
I just created the following:

Private Sub ContractControlNum_AfterUpdate()
Dim L2result As String
L2result = Left(Me![ContractControlNum], 2)
If L2result <> "AB" Then
'or L2result <> "TR" Then
MsgBox "You must enter either the letters TR or AB in front of the Number."

End If

End Sub
This works for AB but when I uncomment for TR to also be a choice for the entry I get error 13 type mismatch?
Any way to fix this ?
 
It would be:

If L2result <> "AB" OR L2result <> "TR" Then
 
It would be:

If L2result <> "AB" OR L2result <> "TR" Then

That's correct but it does not work when I do that. Anyone have a solution for me?
 
MsgBox (resultant action) should be on the same line as the "If ... Then" test
or you must use an "If ... Then ... Else ... End If" line-by-line structure
 

Users who are viewing this thread

Back
Top Bottom