M
MikeS
I have a form in which a Model Number and Serial Number gets scanned into
their respective fields. I am trying to validate these numbers so they don't
get crossed. Serial Numbers always begin with the letters "TH". So here is
my code:
Private Sub Model_AfterUpdate()
On Error GoTo Err_Model_AfterUpdate
If Left(Me.Model.Value, 2) = "TH" Then
Me.Model.Value = ""
MsgBox "Invalid Model Number! ", vbOKOnly
Me.Model.SetFocus
End If
Exit_Model_AfterUpdate:
Exit Sub
Err_Model_AfterUpdate:
MsgBox Err.Description
Resume Exit_Model_AfterUpdate
End Sub
The problem is the focus will not go back to the "Model" field.
Can anyone tell me why?
Thanks in advance,
MikeS
their respective fields. I am trying to validate these numbers so they don't
get crossed. Serial Numbers always begin with the letters "TH". So here is
my code:
Private Sub Model_AfterUpdate()
On Error GoTo Err_Model_AfterUpdate
If Left(Me.Model.Value, 2) = "TH" Then
Me.Model.Value = ""
MsgBox "Invalid Model Number! ", vbOKOnly
Me.Model.SetFocus
End If
Exit_Model_AfterUpdate:
Exit Sub
Err_Model_AfterUpdate:
MsgBox Err.Description
Resume Exit_Model_AfterUpdate
End Sub
The problem is the focus will not go back to the "Model" field.
Can anyone tell me why?
Thanks in advance,
MikeS