472,090 Members | 1,267 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,090 software developers and data experts.

What is the Validation Rule for a certain number of digits phone number?

176 100+
I haven't found anything that would help me to understand the correct syntax for having a certain number of digits phone number validation rule.

My input mask for this field is: \000\-0000000;;
When I set the following validation rule: 9999999999 or =9999999999 it doesn't work correctly and it allows short numbers.

How should I compose it correctly.

Thanks, Michael.
Feb 7 '07 #1
6 26455
ADezii
8,830 Expert 8TB
I haven't found anything that would help me to understand the correct syntax for having a certain number of digits phone number validation rule.

My input mask for this field is: \000\-0000000;;
When I set the following validation rule: 9999999999 or =9999999999 it doesn't work correctly and it allows short numbers.

How should I compose it correctly.

Thanks, Michael.
0 - Digit (0 to 9, entry required, plus [+] and minus [–] signs not allowed).
9 - Digit or space (entry not required, plus and minus signs not allowed).
Feb 7 '07 #2
willakawill
1,646 1GB
Your input mask will give you a 3 digit area code always starting with 0 followed by 6 digits. The only thing your validation rule can check for is if the field has been filled in by the user or left blank and only if the field has changed. The mask will take care of validating input
Feb 7 '07 #3
Michael R
176 100+
Your input mask will give you a 3 digit area code always starting with 0 followed by 6 digits. The only thing your validation rule can check for is if the field has been filled in by the user or left blank and only if the field has changed. The mask will take care of validating input
You are right,
Thanks.

Is there a way to customize the error message the intput masks returns?
Feb 7 '07 #4
MSeda
159 Expert 100+
On a form you can you run validations in a controls before update event like
Expand|Select|Wrap|Line Numbers
  1.  if Len(me.textbox) <> 10 then
  2. msgbox "Phone # must have ten digits"
  3. cancel=true
  4. end if  
unfortunately on the table level you get what you get for validations and error messages.
Feb 8 '07 #5
shiznaw
29
Thank you very much for solving a problem that comes up when beginners like me begin to program. I appreciate your knowledge.

Thank you again for chosing to share. Your answer worked when placed in a form.

Shiznaw 11-24-09
Nov 24 '09 #6
missinglinq
3,532 Expert 2GB
@Michael R
This will do that, 2279 being the error code for data not matching the Input Mask:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  2. Dim Message As String
  3.  If DataErr = 2279 Then 'Data entered doesn't match Input Mask
  4.   Message = "You Have Entered Invalid Data For The Field: " & Me.ActiveControl.Name
  5.   Response = MsgBox(Message, vbExclamation, "Invalid Value Entered")
  6.   Response = acDataErrContinue
  7.  End If
  8. End Sub
Linq ;0)>
Nov 24 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by simina | last post: by
14 posts views Thread by milkyway | last post: by
9 posts views Thread by julie.siebel | last post: by
10 posts views Thread by JackM | last post: by
9 posts views Thread by jasonchan | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.