Using Not Like In A Procedure

  • Thread starter Thread starter Arturo
  • Start date Start date
A

Arturo

I am using the following code to block entries that contain the letters “PXâ€.

Private Sub Destination_AfterUpdate()
If Destination Like "*PX*" Then
MsgBox "This is a Pyxis location." & Chr(10) & Chr(10) & _
"Please use the appropriate Pyxis input form for this
transaction." & Chr(10) & Chr(10) & _
"Thank you.", vbOKOnly, "INVALID ENTRY"
Destination.SetFocus
Destination = ""
End If
End Sub

Now, I would like to do just the opposite, i.e.,block orders that do not
have the PX letters. I tried to add "Not" in front of "Like" and it didn't
work. (If Destination Not Like "*PX*" Then)

What do I use to identify entries that do not have the letters “PX†in them?

Thank you.
 
hi Arturo,
Now, I would like to do just the opposite, i.e.,block orders that do not
have the PX letters. I tried to add "Not" in front of "Like" and it didn't
work. (If Destination Not Like "*PX*" Then)
Simply change order:

If Not Destination Like "*PX*" Then ..


mfG
--> stefan <--
 
Back
Top