Range Between A* and M*

J

JohnV

I have a large table that I am trying to Query a range of customers for. I
want to pull all customers that start with A and run through names starting
with M. I have tried the following:
= "A*" and <= "M*"

but this excludes all customers starting with M such as Max or Murray. I
have seen examples using:

Between Like "A*" and Like "M*"

but I get the error "The expression you entered contains invalid syntax".
The table contains 100Ks of rows and the query result will contain about 52K
rows.

Any help is appreciated.

JohnV
 
K

KARL DEWEY

Try this as criteria --

JohnV said:
I have a large table that I am trying to Query a range of customers for. I
want to pull all customers that start with A and run through names starting
with M. I have tried the following:


but this excludes all customers starting with M such as Max or Murray. I
have seen examples using:

Between Like "A*" and Like "M*"

but I get the error "The expression you entered contains invalid syntax".
The table contains 100Ks of rows and the query result will contain about 52K
rows.

Any help is appreciated.

JohnV
 
J

John Spencer

="A" And < "N"


Or
="A" and <= "Mzzzzzzzz"

Or
Field: Left(CustomerName,1)
Criteria: Between "A" and "M"

The first two can use an index on the CustomerName field (and with lots of
records will be faster). The last cannot use the index.
 
J

John Vinson

I have a large table that I am trying to Query a range of customers for. I
want to pull all customers that start with A and run through names starting
with M. I have tried the following:

Or

LIKE "[A-M]*"


John W. Vinson[MVP]
 
Top