Like Command Syntax Error

Novice1

Registered User.
Local time
Yesterday, 23:59
Joined
Mar 9, 2004
Messages
385
Can I use the Like command in an If Then statement? I'm getting a syntax error

If [Primary1Name] Like 'PO*' Then

MsgBox "You cannot use a post office box address. Use a residence address.", vbOKOnly, "Incorrect Address Information"
DoCmd.GoToControl "Primary1Address1"

Else

End If
 
Yes, but you aren't referencing Primary1Name correctly. In VBA you need to reference the control that contains that value, not the field name.
 
Please explain further.
 

Users who are viewing this thread

Back
Top Bottom