Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Phone Numbers in List Box 1

Status
Not open for further replies.

OpalBiz

Technical User
Mar 24, 2003
5
US
I have a contacts database that stores phone numbers. The text box where these numbers are added and modified has the following input mask:

"(###) ###-####"

These phone numbers along with other information are queried to list boxes. Each number appears without the parentheses, space and hyphen just like they are stored in the table. For example, the list box displays 8005551212 rather than (800) 555-1212. How can the SQL statement be modified to format these numbers?

Below is an example of one SQL statement:

With Me.lstVendors
.RowSource = "SELECT ID, Contact, Phone FROM tblVendors"
.ColumnCount = 3
.ColumnWidths = "0;1.5 in;1.5 in;"
.ColumnHeads = True
.Requery
End With

Any help would be greatly appreciated.
 
Have you tried this ?
.RowSource = "SELECT ID, Contact, Format(Phone, '(###) ###-####') FROM tblVendors"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank you. That worked perfectly. I've been trying to use double quotes rather than single quotes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top