establish limits

  • Thread starter Thread starter francisco
  • Start date Start date
F

francisco

is there is a way to limit text to numbers only?
and if i have to change to numeric data type, How can that
number be limited to inly 4 digits
 
If this text box is unbound, set its Format property to "General Number" to
prevent users type non-numeric values.

If the text box is bound to a field in a table, open the table in design
view, and ensure the Data Type of the field is Number.

If you want to prevent users typing anything except digits into a text box
(no minus sign, no decimal point, ...), you could use this in the KeyPress
event procedure:
If KeyAscii < 48 Or KeyAscii > 57 Then
If KeyAscii <> vbKeyBack Then
KeyAscii = 0
End If
End If
 
Back
Top