J
jserrone via AccessMonster.com
Hello,
I have a simple text box and I would like to restrict a user to key in
something with an A followed by 6 digits. Similar to this A555555 so that if
the user keys in 555555 or P555555 it will receive an error message. I know
if VBA I can restrict a user to enter numbers only by doing the following on
the Key Press event but don't know how to incorporate the first digit as a
Letter.
Private Sub Text1_KeyPress(KeyAscii As Integer)
'check if value is numeric
If Not IsNumeric(Chr(KeyAscii)) Then
'allow backspace and enter keys only
If Not (KeyAscii = 8 Or KeyAscii = 13) Then
KeyAscii = 0
End If
End If
End Sub
I have a simple text box and I would like to restrict a user to key in
something with an A followed by 6 digits. Similar to this A555555 so that if
the user keys in 555555 or P555555 it will receive an error message. I know
if VBA I can restrict a user to enter numbers only by doing the following on
the Key Press event but don't know how to incorporate the first digit as a
Letter.
Private Sub Text1_KeyPress(KeyAscii As Integer)
'check if value is numeric
If Not IsNumeric(Chr(KeyAscii)) Then
'allow backspace and enter keys only
If Not (KeyAscii = 8 Or KeyAscii = 13) Then
KeyAscii = 0
End If
End If
End Sub