V
vbcraft
Is there a way to accept only numbers in a form field.
Validation...
Validation...
Peter said:Yes, in the KeyPress event enter the following code like so :-
Private Sub YourFieldName_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) Like "[!0-9.]" And KeyAscii <> vbKeyBack Then
KeyAscii = 0
End Sub
where YourFieldName is the name of your text box control. Note that
the code should all be on one line and if you do not need decimal
points then omit the . character. If you need to be able to enter
negative values, add the - characters to the end of the string, i.e.
Like "[!0-9.-]
HTH
Peter Hibbs.
Is there a way to accept only numbers in a form field.
Validation...