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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to add dashes to data for export

Status
Not open for further replies.

emzadi

IS-IT--Management
Feb 13, 2001
69
US
One database has phone numbers as 10-digit numbers with no dashes, the other uses the 111-555-1212 format. How can I export the 10-digit/no dash data so that it has dashes in the appropriate places?

Thank you,
S. Wagner
LAPELS Susan M. Wagner
LAPELS
susanw@lapels.com
 
A quick fun one...
Create a new query and flip to SQL view. Paste this in:

SELECT Table1.Field1, Left([Field1],3) & "-" AS X, Mid([Field1],4,3) & "-" AS Y, Mid([Field1],7,4) AS Z, [X] & [Y] & [Z] AS Answer
FROM Table1;

Before moving an inch, everywhere you see them, change "Table1" to the name of your table, and "field1" to the name of your field. Run the query and you'll see how it works. "Answer" is your field to output. Enjoy! Gord
ghubbell@total.net
 
Similar to Gord's approach:

SELECT tblOne.a, tblOne.b, tblOne.c, Format([phone],"0000000000") AS xphone INTO tblTemp
FROM tblOne;


then export tblTemp


Dave
 
Thank you so much!
Got it. :)
Started with ghubbell's solution and it worked great.

Emzadi Susan M. Wagner
LAPELS
susanw@lapels.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top