473,847 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.MyPhone Num? 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 8302
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.MyPhone Num? 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(Le n([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
19239
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 pretty limited. I wrote the following expression to take (hopefully) any _reasonable_ phone number input, and format it as (999) 999-9999 x 9999.
0
1664
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 isbns that start with 0 are going in as 9 digit numbers, the 0 is being ignored or stripped. I have experienced this before with integer data types ignoring leading 0s. I'm wondering how to address this? Should I change the field to a varchar...
4
4554
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
2528
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 arithmetic.
9
1556
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 digits only and than we need to scroll with cursor to see last two digits. I have tried to change the display settings of monitor and even I replaced the monitor but still it shows 8 digit only. Is there any other settings for paricular workstaion I...
0
1109
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
8671
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, but we started facing issues once we go above 15 digits. Thanks, Venkat
7
3887
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 - client and phone linked by client id right now I get contact a - phone number 1 contact a - phone number 2 I would like
14
4379
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 into the URL string on a refresh of the form page. I am very green on CF and CFM files and have this code below; I need to help for the error messages to "pop up" in a new window or display on the body of the page so anyone filling out the form knows...
0
9886
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10983
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
10647
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10338
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...
0
9481
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7882
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
5719
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
5910
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4527
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

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.