Query on zip codes

D

Dirk_Bob

I have a query that searches a database for matching zip codes. The user
enters the desired 5 digit zip code and the query displays the necessary
information.

The database has zip codes stored as 3 digit (first 3 digits of zip) and 5
digit.
How can I write the query to find both the 3 and 5 digit matches?
 
C

Chris2

Dirk_Bob said:
I have a query that searches a database for matching zip codes. The user
enters the desired 5 digit zip code and the query displays the necessary
information.

The database has zip codes stored as 3 digit (first 3 digits of zip) and 5
digit.
How can I write the query to find both the 3 and 5 digit matches?

Dirk,

It might be something like this (untested):

SELECT T1.ZipCode5
,T1.ZipCode3
FROM <your table> AS T1
WHERE T1.ZipCode5 = Forms!YourForm!YourControl
OR T1.ZipCode3 = LEFT(3,Forms!YourForm!YourControl)


Sincerely,

Chris O.
 
J

JerryW

I have a query that searches a database for matching zip codes. The user
enters the desired 5 digit zip code and the query displays the necessary
information.

The database has zip codes stored as 3 digit (first 3 digits of zip) and 5
digit.
How can I write the query to find both the 3 and 5 digit matches?

Have your users only enter the first three characters of the zipcode.
The criteria would be something like:

Like [First 3 of Zip] & "*"

Jerry Whittle MVP
 

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