J
Jim
Using code on the net I put together this:
Private Sub tbxDrug_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With Me.tbxDrug
If Not Like "[A-Z][A-Z]###" Then
MsgBox "blah blah"
Cancel = True
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End If
End With
End Sub
This is supposed to validate that the entered data is in the format a
AA123.
But it seems IF NOT LIKE is not a valid command. Is it valid or do I
need to go about this another way?
Jim
Private Sub tbxDrug_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With Me.tbxDrug
If Not Like "[A-Z][A-Z]###" Then
MsgBox "blah blah"
Cancel = True
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End If
End With
End Sub
This is supposed to validate that the entered data is in the format a
AA123.
But it seems IF NOT LIKE is not a valid command. Is it valid or do I
need to go about this another way?
Jim