Searching on first 5 characters in a field

R

REGREGL

Hello all.

I would like to create a query which returns phone number records that match
the first 5 characters submitted. The idea being to show customers which
have similar telephone numbers to the one being queried. Any ideas on how I
can do this?
 
F

fredg

Hello all.

I would like to create a query which returns phone number records that match
the first 5 characters submitted. The idea being to show customers which
have similar telephone numbers to the one being queried. Any ideas on how I
can do this?

As criteria on the Phone field, write:
Like [Enter first 5 numbers] & "*"
 
J

Jeff Boyce

Create a new query in design view.

Add the table.

Add the field.

In the Selection Criterion "cell" under the field, add:
Like [Enter the first 5 characters] & *

Save and run the query.

This query will prompt the person running it to provide a "starts with"
search string and then find anything in the field that starts with those
characters. Note that it is not (and need not be) limited to 5 characters.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
R

REGREGL

Thanks!!! That should work fine! Why didn't I think of that?

Jeff Boyce said:
Create a new query in design view.

Add the table.

Add the field.

In the Selection Criterion "cell" under the field, add:
Like [Enter the first 5 characters] & *

Save and run the query.

This query will prompt the person running it to provide a "starts with"
search string and then find anything in the field that starts with those
characters. Note that it is not (and need not be) limited to 5 characters.

Regards

Jeff Boyce
Microsoft Office/Access MVP

REGREGL said:
Hello all.

I would like to create a query which returns phone number records that
match
the first 5 characters submitted. The idea being to show customers which
have similar telephone numbers to the one being queried. Any ideas on how
I
can do this?
 
Top