To prevent the field being left blank, open the table in design view, select
the field, and set these properties:
Required Yes
Allow Zero Length No
You could set up an Input Mask so the field accepts numbers only.
Alternatively, if you enter data through a form, you could set the text
box's On Key Down property to [Event Procedure], and use the following
procedure to prevent the user entering anything except digits or backspace:
Sub DigitOnly(KeyAscii As Integer)
'Purpose: Disallow any keystroke except 0 ~ 9, and backspace.
'Usage: In a text box's KeyDown event procedure:
' Call DigitOnly(KeyAscii)
If KeyAscii < 48 Or KeyAscii > 57 Then
If KeyAscii <> vbKeyBack Then
KeyAscii = 0
End If
End If
End Sub
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
adriany said:
looks like my txtbox accepts null(blank data).
how do i make it so only accepts input data that are
numbers only not letter(text).
i don't want table field to be number