Phone number formatting

G

Guest

I have a situation were I would like to be able to reformat the phone
number in a table. For example if my number looks like 5551234567
how can I update or reformat it to look like 555-123-4567 in the table? The
field is a text field.
Thanks!
 
D

Douglas J. Steele

Set its format to 000-000-0000

If you want the change to be permanent, you'll need to use an Update query
along the lines of

UPDATE MyTable
SET MyNewPhone = Format(MyOldPhone, "000-000-0000")
WHERE MyOldPhone IS NOT NULL

(note that I'm suggesting creating a new field in the table, just in case
something goes wrong!)
 
M

Mike Painter

rockhound said:
I have a situation were I would like to be able to reformat the phone
number in a table. For example if my number looks like 5551234567
how can I update or reformat it to look like 555-123-4567 in the
table? The field is a text field.
Thanks!

I always use @@@ @@@-@@@@
this gives 555 123-1234 or just 555-1212.
If not you will have extra work to show
555-555-1212 and not show -555-1212
 
J

Joseph Meehan

rockhound said:
I have a situation were I would like to be able to reformat the phone
number in a table.

No, you want to reformat the phone number in queries, forms and reports.
Tables are just buckets in which to store data, not view or edit it. :)
 

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

Top