Changing Data format in a field

G

Guest

In a query I am importing data from another program and appending it into a
table, The data being imported has phone number fields in the format
(123)456-1234

I need to remove the brackets and the dash from the data so the phone number
is 1234567890

Thanks
 
B

Brendan Reynolds

You can use the Replace() function, replacing the unwanted characters with
an empty string. For example, in an update query ...

UPDATE tblTest SET tblTest.TestText =
Replace(Replace(Replace([TestText],"(",""),")",""),"-","");

See 'Replace function' in the VBA help file for details.
 
J

John Vinson

In a query I am importing data from another program and appending it into a
table, The data being imported has phone number fields in the format
(123)456-1234

I need to remove the brackets and the dash from the data so the phone number
is 1234567890

Thanks

If you're using A2000 or later, run an Update query updating [Phone]
to

Replace(Replace(Replace([Phone], "(", ""),")", ""), "-", "")


John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top