Hi all,
I've set the code below on a text box so it only allows the user to enter numbers. However when I enter in letters and hit Tab it brings up the message and instead of setting focus back in the current box it goes to the next field.
How do I stop that from happening?
Thanks
I've set the code below on a text box so it only allows the user to enter numbers. However when I enter in letters and hit Tab it brings up the message and instead of setting focus back in the current box it goes to the next field.
How do I stop that from happening?
Code:
Private Sub
Txt_NewVolume_Exit(Cancel As Integer)
If Me.Txt_NewVolume Like "*[A-Z]*" Or Me.Txt_NewVolume Like "*[@#$%*^&?()<>/\'""!]*" Then
MsgBox ("Please enter numbers only")
Me.Txt_NewVolume.Value = vbNullString
Me.Txt_NewVolume.SetFocus
Else
End If
End Sub
Thanks