473,698 Members | 2,313 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

176 New Member
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 27672
ADezii
8,834 Recognized Expert Expert
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 Top Contributor
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 New Member
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 Recognized Expert New Member
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 New Member
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 Recognized Expert Specialist
@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

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

Similar topics

8
6980
by: Eric Linders | last post by:
Hi, I'm trying to figure out the most efficient method for taking the first character in a string (which will be a number), and use it as a variable to check to see if the other numbers in the string match that first number. I'm using this code for form validation of a telephone number. Previous records from the past few months show that when someone is just messing around on one of our forms (to waste our time), they type
21
6234
by: AnnMarie | last post by:
<script language="JavaScript" type="text/javascript"> <!-- function validate(theForm) { var validity = true; // assume valid if(frmComments.name.value=='' && validity == true) { alert('Your full name is required. Please enter your full name!'); validity = false; frmComments.name.focus();
6
7131
by: simina | last post by:
Hi... I have a form with 4 number fields: phone area, phone number, cell area, cell number. I did a function that checks the "number" issue for all 4 fields in the same time (because the code is onBlur: "return ph(this);"). Now the problem is that if the user hits Enter data still goes to the database (of course, because I should have the function called in the form's onSubmit...... But how can I do this because I should now have 4...
8
15502
by: SAN CAZIANO | last post by:
i have to do in the onkeypress or in onchange the float (real) field validation I try something: function ValidaCampo(nomeCampo,TotInteri,TotDecimali) { DecimalPos=NomeCampo.value.Indexof(','); Lungh=TotInteri+TotDecimali+1; //sum the ineger + decimal + decimal separator
14
1720
by: milkyway | last post by:
Hello, Is there a good validation package out there that can be used with javascript? I have tried the one here: http://www.peterbailey.net/fValidate/ but had some problems implementing it ;-( I have seen the one from Dreamweaver but I am not using this package.
9
4173
by: julie.siebel | last post by:
Hello all! As embarrassing as it is to admit this, I've been designing db driven websites using javascript and vbscript for about 6-7 years now, and I am *horrible* at form validation. To be honest I usually hire someone to do it for me, grab predone scripts and kind of hack out the parts that I need, or just do very minimal validation (e.g. this is numeric, this is alpha-numeric, etc.)
10
14297
by: JackM | last post by:
I'm still working on validating the phone numbers that are entered on a form but have come across a problem I don't understand how to fix. I can handle most instances when it's in regular US formats (555-555-5555 or (555) 555-5555 or 555 555 5555) but I'm having trouble when the entry is ten consecutive numbers with nothing else (5555555555). Not only does it not validate, but it shows as 2147483647 when I call the variable to check to see...
9
1621
by: jasonchan | last post by:
im fairly new at javascript but i need to write a script for a project and don't know where to begin. basically it involves form validation... i guess here's the breakdown. I have created a form in html already and need to figure out how to write this script. 1. select any number of products (checkboxes) and set quantities for each. Must set at least one product and selected products must have a quantity value > 0. 2. The second...
2
2190
by: komaladevi | last post by:
hello all ! Can any one help me in validating US Phone Number , I wrotethe javascript for this to get the phone number as 123-234-1234 but i dont know the reason why i am getting this format only after entereing the 11 digit can anyone tell me how can i solve this problem or can anyone help me to get this format for us phonenumbers. I want the code like while entering the digits only i should get "-" at the 4th and 8th positions and...
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6522
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.