Using update query to update phone numbers.

G

Guest

As in my last question, I have a table with addresses and phone numbers.
Some of the entries are outside my metropolitan area, hence, different area
codes. I have already done a query to separate the foreign area codes and
now need to do an update query to put a 1 in front of the phone number. How
do I add a 1 to update the phone numbers. I would like to update the entire
column at one time. Keep in mind, I have segregated these numbers from my
home area numbers.
 
V

Van T. Dinh

Use something like:

"1" & [Phone Number]

in the "Update To" row of your Update Query.
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Something like this:

UPDATE table_name
SET phone_number = "1" & phone_number
WHERE phone_number NOT LIKE "123*"
AND phone_number NOT LIKE "456*"
AND ... etc. for each local area code ...

OR use a WHERE clause like this:

WHERE Left(phone_number,3) Not IN ("123","456","789")

Where the area codes in the IN () phrase are the local area codes.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRE6hKoechKqOuFEgEQLYWwCfW4w35E1LKfiqGwYCYAyPFeGDQlMAn1tT
TDwTDETkiFAsvGrRo3rWydLe
=BaWa
-----END PGP SIGNATURE-----
 
G

Guest

Thank you for your quick reply. What I have already done is a delete query
where all the local numbers were deleted and the new table had only foreign
city phone numbers. Therefore, the table I am working with has only foreign
numbers.
 
G

Guest

Thank you. This sounds good. My training has acquainted me with update
queries and the ampersand (squish together), but hadn't given me enough to
put this together.

Van T. Dinh said:
Use something like:

"1" & [Phone Number]

in the "Update To" row of your Update Query.

--
HTH
Van T. Dinh
MVP (Access)



faxylady said:
As in my last question, I have a table with addresses and phone numbers.
Some of the entries are outside my metropolitan area, hence, different
area
codes. I have already done a query to separate the foreign area codes and
now need to do an update query to put a 1 in front of the phone number.
How
do I add a 1 to update the phone numbers. I would like to update the
entire
column at one time. Keep in mind, I have segregated these numbers from my
home area numbers.
 

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