Question How to check numeric input data (1 Viewer)

rickyfong

Registered User.
Local time
Today, 00:10
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!!
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 08:10
Joined
Sep 12, 2006
Messages
15,658
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
 

Catalina

Registered User.
Local time
Today, 00:10
Joined
Feb 9, 2005
Messages
462
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

Top Bottom