Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LookUp Area Code 1

Status
Not open for further replies.

mlocurci

MIS
Oct 17, 2001
210
US
I have a phone number field where a customer enters their phone number. I want to create a query that looks at the first three digits and matches it to a table of Area Code and States so that I have a new field in my query called calling state. Suggestions?
 
you can create a SQL query and have a field that looks like this:

assuming your phone number looks like this (111)111-1111,

mid(Phone,2,3)

That would start at the second character in the number, and get the next three characters as the result, so the result would look like this 111. You can use that to link to your area code table. If you are not sure how to do that, tell me how you named your tables and fields.
 
Unfortunatly, the Exchange (the second group of three digits) in a ten digit phone number can (often / usually is) included in various area codes.

Try it, you'll NOT like the results. Pick a few phone #'s (last seven digits of the ten digit 'number') and dial with different area codes. You will either get some random answer or a message re [" ... not in Service" | "... has been changed to" | "... has been disconnected | other?].




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top