Validate number of digits (1 Viewer)

sroot

Registered User.
Local time
Today, 09:04
Joined
Mar 18, 2013
Messages
53
I have a form that a user has to type in a number in a text box. The number has to be 12 or 14 digits, so is there any way that if it is anything but 12 or 14 that a message box pops up and tells them to check the number and re-enter it? Thanks for any help!!!
 

moke123

AWF VIP
Local time
Today, 12:04
Joined
Jan 11, 2013
Messages
3,940
Code:
if len(YourField)= 12 or len(YourField)= 14 then
' do whatever
else
Msgbox "Check Number"
end if
 

Minty

AWF VIP
Local time
Today, 17:04
Joined
Jul 26, 2013
Messages
10,375
You can check with the Len() function in the after update even
Code:
If Not (Len(Me.YourTextBox) =12 OR Len(Me.YourTextBox)) = 14 Then
   MsgBox"Incorrect No of digits"
End if
 

sroot

Registered User.
Local time
Today, 09:04
Joined
Mar 18, 2013
Messages
53
Thanks that worked perfectly. I can't believe that i had forget to use"len". Thanks so much!
 

Users who are viewing this thread

Top Bottom