Select between

  • Thread starter Thread starter Derk
  • Start date Start date
D

Derk

I need to write a report where the user can enter the first and last letter
of the surname eg If they enter D and E, I want to select anyone with a
surname of D and E. I have got it working up to a point.

I have a Report using a query as the datasource and I pass two Variables to
the query eg txtFrstLetter and txtLastLetter. When I enter D* and E* I only
get Surname beginning with D. I think its because Access is setting up a
range of DA---- to EA------.

Is my assumption correct, if so how do I sort it out

Thanks

Derrick
 
What you want is D* OR E*

The first letter of anything can't possibly be both D and E, it has to be
one of the other.
 
Derk said:
I need to write a report where the user can enter the first and last letter
of the surname eg If they enter D and E, I want to select anyone with a
surname of D and E. I have got it working up to a point.

I have a Report using a query as the datasource and I pass two Variables to
the query eg txtFrstLetter and txtLastLetter. When I enter D* and E* I only
get Surname beginning with D. I think its because Access is setting up a
range of DA---- to EA------.


This should deal with that issue:

Left(surname, 1) Between txtFrst AND txtLast & "ZZZ"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top