473,320 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Easiest way to display properly formatted US 10 and 7 digit phone numbers?

MLH
Using A97, I have tables with 10-char text phone number fields to
allow entry of xxxyyyyyyy phone numbers - where xxx is the 3-digit
area code and yyyyyyy is the 7-digit phone number. I wish to display
these as (xxx) yyy-yyyy. Trouble is, some telephone numbers are
entered by users as only 7-digits. They omit the area code in many
cases, understandably. They consider it redundant and its not
necessary for them to dial it - in most cases, only the 7-digit
yyyyyyy part is required.

If I'm displaying them in query, what's the best syntax to put in
the SQL in the field displaying MyTable.MyPhoneNum? If
there's a 10-digit number, I wanna see (xxx) yyy-yyyy and if
there's only 7-digits, I wanna see yyy-yyyy.
Nov 13 '05 #1
2 8253
MLH
Part 2 of this question is how to set up the Format property for a
textbox control on a data entry form who's record source is a table to
display the phone number properly formatted as a 10-digit or 7-digit
phone number after user enters a number into the field.

I don't want to use an input mask like !\(999") "000\-0000;;_ or like
!\(000") "000\-0000;;_ because I do not want to restrict the user
to entering 10 digits or force him to arrow past the first three (AC)
digits if he wishes to enter 7-digits only (instead of 10). In other
words, I want to give the user complete freedom to enter 7 or 10
at his own discretion. And after he enters it into the control, I want
to show it properly formatted. Is this making sense?
Nov 13 '05 #2
On Tue, 16 Aug 2005 22:31:42 -0400, MLH wrote:
Using A97, I have tables with 10-char text phone number fields to
allow entry of xxxyyyyyyy phone numbers - where xxx is the 3-digit
area code and yyyyyyy is the 7-digit phone number. I wish to display
these as (xxx) yyy-yyyy. Trouble is, some telephone numbers are
entered by users as only 7-digits. They omit the area code in many
cases, understandably. They consider it redundant and its not
necessary for them to dial it - in most cases, only the 7-digit
yyyyyyy part is required.

If I'm displaying them in query, what's the best syntax to put in
the SQL in the field displaying MyTable.MyPhoneNum? If
there's a 10-digit number, I wanna see (xxx) yyy-yyyy and if
there's only 7-digits, I wanna see yyy-yyyy.


PhoneNum:IIf(Len([PhoneField])=10,Format([PhoneField],"(@@@)
@@@-@@@@"),Format([PhoneField],"@@@-@@@@"))

(805) 123-4567
123-4567

Or if you don't mind an empty area code section if the length is 7
characters, i.e. ( ) 456-1478
PhoneNum: Format([Phone],"(@@@) @@@-@@@@")
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: joemono | last post by:
Hello everyone! First, I appologize if this posting isn't proper "netiquette" for this group. I've been working with perl for almost 2 years now. However, my regular expression knowledge is...
0
by: Eben Goodman | last post by:
I am storing book isbn numbers in a table. isbn numbers are 10 digit numbers and many start with 0. The data type of the field I am storing this info in is a bigint(16) unsigned. It appears that...
4
by: Brian Henry | last post by:
I have phone numbers like this in a data table 123-435-1234 1231231234 432.234.2321 they all have different formatting, what I want to do is get them all formatted like this (123) 123-1234
8
by: nineteen | last post by:
for example: 16/5: 3 -------- 5)16 15 -------- 1 the user input the dividend and divisor,the program should display the upright formula like the example. and , the program must use recursive...
9
by: mukeshhtrivedi | last post by:
We have MS Access 2000 Application (on Network- file server) and it workd fine as intended. However in one of our Windows XP computer (workstation) in bookd jobs module 10 digit field shows 8...
0
by: nopro | last post by:
In a winform Datagrid I display information about costumer phone-numbers. phonenumer phone/fax/mobile the values in the database table are 1 for phone 2 for fax 3 for mobile
14
by: thehobbit | last post by:
Hi, Could anyone give ideas on how to add 4 20 digit numbers in ANSI C and pass the result back to a calling program in COBOL? We were able to add up to 15 digit numbers without any problems,...
7
by: Propoflady | last post by:
My contacts can have as many as five or six phone numbers - is it possible to make a query that puts the name, and each phone number after it on the same line - for this reason I have two tables -...
14
by: confusedfusion | last post by:
Not sure how many form submissions that have been lost over the years before I started but the company has a contact form that the required fields when validation fails the error message is going...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.