Question How to check numeric input data

rickyfong

Registered User.
Local time
Today, 00:43
Joined
Nov 25, 2010
Messages
199
I have an input box and wanted user just to input 7 digital data. However, I am afraid user may enter string data. Is there any way to check and ensure user can only input 7 digital data to that input box? Thanks a lot!!
 
in before update event for control

something like this

Code:
 if not isnumeric(controlname) then
    msgbox "please enter a number"
    cancel = true
    exit sub
 end if
  
 if not len(controlname) = 7 then
    msgbox "entry must be 7 characters in length"
    cancel = true
    exit sub
 end if
 
I always use this in the On Ke yPress Event of the form field to make
sure only numbers are entered

If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0
 

Users who are viewing this thread

Back
Top Bottom