how can I remove parenthesis from phone numbers?

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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
 
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.
 
Back
Top