Area codes search

D

d9pierce

Hi all,
Is there a way to take the area code from a phone number and store
that in a separate field? We do a lot of area code searches and I need
to take the first 3 numbers (AreaCode) from my phone numbers and place
that in a separate field or create a search function on my search
criteria that will only pick up the first three numbers. Is this
possible and if so any examples or advise would be great!
Thanks,
Dave
 
K

kingston via AccessMonster.com

Left([PhoneField],3) should work for this.

Hi all,
Is there a way to take the area code from a phone number and store
that in a separate field? We do a lot of area code searches and I need
to take the first 3 numbers (AreaCode) from my phone numbers and place
that in a separate field or create a search function on my search
criteria that will only pick up the first three numbers. Is this
possible and if so any examples or advise would be great!
Thanks,
Dave
 
T

tina

if you're using a form for searching, base it on a query rather than the
table, and include a calculated field in the query the returns only the area
codes, as

AreaCode: Left([PhoneNumberFieldName], 3)

if the parens around an area code are included in the field data, it's
slightly tricker, as

AreaCode: Right(Left([PhoneNumberFieldName], 4), 3)

if you don't want the user to see this field in the form, then you can set
criteria on this field, without actually showing the field in the query
output. and, of course, you can leave the field in the query output, but
simply not bind it to a control in your form, if you prefer that.

hth
 
Top