Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2004
    Posts
    34

    Unanswered: Area Code extract

    I have a table with information including 10 dig fax#. I need to extract the area code to seperate field for purposes of using fax software phonebook.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Does every row have a 10 digit phone number? Are there some with only 7? Is this string formatted in a consistent way? If so to the 1st and last question, then write a query with a substring construct (instr or mid or Left) ... Like:

    SELECT DISTINCT MID(MyColumnNameHere,2,3) AS AreaCode FROM SomeTable;

    This gets you unique area codes
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Aug 2004
    Posts
    34
    Thanks for the help...I haven't done much in code lately and knew there was a simple way.

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Falcon049
    Thanks for the help...I haven't done much in code lately and knew there was a simple way.
    This can easily be done using the QBE ... Or as you may know it as the Query Builder ...
    Back to Access ... ADO is not the way to go for speed ...

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if the number of digits in your phone number are inconsistent (ie some include the region (or whatever you guys call the fist 3 diigts in a North American Style phone number then it may make sense to use right, rather than mid that way round you will always get the area code.

    eg
    Code:
    left$(right$(<myphonenumber>,7),3)
    ... just pray you never come accross european, and especially British phone numbers
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •