473,978 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Phone Format (770) 123-1234

Hi,

How do I apply phone format in a string field? for example (770) 123-1234.
Please let me know.

Thanks.

Eddy
Nov 17 '05 #1
3 12524
Hi Eddy,

If you are validating input, you can use a RegularExpressi onValidator and
select U.S. Phone Number in the Regular Expression Editor (by clicking the
elipses in the ValidationExpre ssion box in the RegularExpressi onValidator's
Properties window).
--
Ray Dixon - Microsoft MVP
ra*@NOSPAM.gree ble.com
(remove NOSPAM. from my e-mail address for a direct reply)
"Eddy Soeparmin" <es********@cli entprofiles.com > wrote in message
news:uC******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

How do I apply phone format in a string field? for example (770) 123-1234.
Please let me know.

Thanks.

Eddy

Nov 17 '05 #2
you'd have to use javascript to do this
"Eddy Soeparmin" <es********@cli entprofiles.com > wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi Ray,

No, this is not at validation. It's for display. For example, I just
retrieved data from database and would like to display phone number in (123) 123-1234 format within a datagrid.

Eddy

"Ray Dixon [MVP]" <ra*@NOSPAM.gre eble.com> wrote in message
news:uu******** ******@TK2MSFTN GP12.phx.gbl...
Hi Eddy,

If you are validating input, you can use a RegularExpressi onValidator and
select U.S. Phone Number in the Regular Expression Editor (by clicking the elipses in the ValidationExpre ssion box in the

RegularExpressi onValidator's
Properties window).
--
Ray Dixon - Microsoft MVP
ra*@NOSPAM.gree ble.com
(remove NOSPAM. from my e-mail address for a direct reply)
"Eddy Soeparmin" <es********@cli entprofiles.com > wrote in message
news:uC******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

How do I apply phone format in a string field? for example (770)

123-1234. Please let me know.

Thanks.

Eddy



Nov 17 '05 #3
Function FormatPhoneNumb ers(ByVal strInputPhoneNu mber As String) As String

'Strip off the ( , ) and -

Dim strPhoneNumber As String

strInputPhoneNu mber = strInputPhoneNu mber.Replace(" ", "")

strInputPhoneNu mber = strInputPhoneNu mber.Replace("( ", "")

strInputPhoneNu mber = strInputPhoneNu mber.Replace(") ", "")

strInputPhoneNu mber = strInputPhoneNu mber.Replace("-", "")

'Now format it

If strInputPhoneNu mber.Length >= 3 Then

strPhoneNumber = "(" & strInputPhoneNu mber.Substring( 0, 3) & ") "

If strInputPhoneNu mber.Length < 6 Then

strPhoneNumber = strPhoneNumber & strInputPhoneNu mber.Substring( 3,
strInputPhoneNu mber.Length - 3)

Else

strPhoneNumber = strPhoneNumber & strInputPhoneNu mber.Substring( 3,
3) & "-" & strInputPhoneNu mber.Substring( 6)

End If

End If

Return strPhoneNumber

End Function
--
Swanand Mokashi
Microsoft Certified Professional
http://www.swanandmokashi.com/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"Eddy Soeparmin" <es********@cli entprofiles.com > wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi Ray,

No, this is not at validation. It's for display. For example, I just
retrieved data from database and would like to display phone number in (123) 123-1234 format within a datagrid.

Eddy

"Ray Dixon [MVP]" <ra*@NOSPAM.gre eble.com> wrote in message
news:uu******** ******@TK2MSFTN GP12.phx.gbl...
Hi Eddy,

If you are validating input, you can use a RegularExpressi onValidator and
select U.S. Phone Number in the Regular Expression Editor (by clicking the elipses in the ValidationExpre ssion box in the

RegularExpressi onValidator's
Properties window).
--
Ray Dixon - Microsoft MVP
ra*@NOSPAM.gree ble.com
(remove NOSPAM. from my e-mail address for a direct reply)
"Eddy Soeparmin" <es********@cli entprofiles.com > wrote in message
news:uC******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

How do I apply phone format in a string field? for example (770)

123-1234. Please let me know.

Thanks.

Eddy



Nov 17 '05 #4

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

Similar topics

5
19252
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.
2
10840
by: Roxie Aho | last post by:
Using Access 2003. Linked table from SQL Server has phone as 1234567890. Query has phone formatted as (@@@) @@@-@@@@, displaying (123) 456-7890. Data access page is based on the query. Phone field has (@@@) @@@-@@@@ format. It is displaying as 1234567890. How do I get (123) 456-7890 display? Roxie Aho
2
6789
by: Dman | last post by:
Having trouble in Access XP. I want to display the customers name, city and phone number in a Combo Box but the but the formatting is lost – eg (123) 456-7890 is displayed as 1234567890. Any idea how to format the control. From what I can see, the combo box has a format option but I am referring to the 3rd column. The results display properly within the underlying query… it’s the Combo Box that loses the formatting. Thoughts? ...
2
8311
by: MLH | last post by:
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,...
2
1689
by: RD | last post by:
We always have to have an area code but user does not always have to dial the long distance digit 1 before the area code. When user does not have to make long distance call the phone number our format is like (450) 123-4560. When he does have to make a long distance call its like 1 (450) 123-4560. I'm wondering how to specify the input mask to allow for both these cases.. Any help would greatly appreciated. Thanks
4
4560
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
1
2040
by: MuZZy | last post by:
Hi, One of our bigger clients requested to have a phone automation option for our CRM product (developed on C#) as they are using it now with ACT CRM. Unfortunately i don't have much info on how do they use it and no way i could get to tehir place as they are in Europe (i'm in US). All i know that they are using Nortel phones with TAPI interface (connected over LAN?) and on user's machines they are using a TAPI driver "LAN CTE". I've...
7
4662
by: laredotornado | last post by:
Hi, Using php 4.4.4, I am looking to parse a US phone number string into 3 smaller strings -- area code, the first part of the phone number (3 digits) and the last part of the phone number (4 digits). The only given is that there will be 10 digits in the string, but people may include spaces, parens, or other characters. These are all strings I'd expect $p = "5558675309";
2
1553
by: David C | last post by:
Is there a way to validate a specific phone# format on a control? I also want to be able to have the user enter an extension as part of the text. For example, the following would be valid. 123-456-7890 123-456-7890 x123 Below would be invalid. (123) 456-7890
8
2185
by: Nour469 | last post by:
Hi, I encountered a problem and wondering if anyone can help. I have clients and their phone nos stored, I used The data Type: Text and InputMask as "phone: (123) 123-4567 " but when I conduct a search to find a client by the phone No, Access is not able to find record, although I click the " Match any part of field". when I type the phone No with all the brackets and dash it find it. It is very time consuming for the operator to type the...
0
10357
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
10175
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
11827
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
10920
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
10087
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
8465
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
7620
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
5162
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
3
3772
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.