Question on Query

D

Dirk_Bob

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)
 
Top