Question on Query

G

Guest

I have created a query that searches a database based on a zip code entered
by the user.

The question is: The database contains both 3 digit(first 3 digits) zip
codes and 5 digit zip codes. I want the user to enter all 5 digits and still
be able to pull up the 3 digit codes that match. How do I configure the
query to do this?
 
D

Douglas J. Steele

Are you saying that the 3 digit and 5 digit zip codes will be in the same
field in the table?

WHERE [ZipCode] = [What Zipcode?] OR [ZipCode] = Left([What Zipcode?], 3)

If not, and they're in separate fields, you'll want

WHERE [ZipCode] = [What Zipcode?] OR [ZipCode3] = Left([What Zipcode?], 3)
 

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

Top