Validate number of digits

sroot

Registered User.
Local time
Today, 07:37
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!!!
 
Code:
if len(YourField)= 12 or len(YourField)= 14 then
' do whatever
else
Msgbox "Check Number"
end if
 
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
 
Thanks that worked perfectly. I can't believe that i had forget to use"len". Thanks so much!
 

Users who are viewing this thread

Back
Top Bottom