how can I remove parenthesis from phone numbers?

G

Guest

I have a data base with phone numbers as: (999)999-9999. I need to get rid on
the () and - in order to use with a dialer. How?
 
G

Graham R Seach

I think if you want to use it to dial out, you might want to remove the dash
as well, so off the top of my head you have two options that I can think of:

1. strMyNum = Replace(Replace(Replace(strPhone, "(", ""), ")", ""), "-", "")

2. http://www.pacificdb.com.au/MVP/Code/StripChars.htm
...using the following syntax: strMyNum = StripEx(strPhone,
se_AllButNum)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 
F

fredg

I have a data base with phone numbers as: (999)999-9999. I need to get rid on
the () and - in order to use with a dialer. How?

If the () and - is actually STORED in the table (as opposed to just
being displayed by an input mask or the format property), you can
remove the extra characters using an Update query.

If you're version of Access has the Replace() function, then write 3
queries:

Update YourTable Set YourTable.[PhoneField] =
Replace([PhoneField],"(","");

Update YourTable Set YourTable.[PhoneField] =
Replace([PhoneField],")","");

Update YourTable Set YourTable.[PhoneField] =
Replace([PhoneField],"-","");

If you have a version without the Replace function you would need to
write a User Defined function. Post back if this is the case.
 

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