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?].
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.