Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query by Zip code

Status
Not open for further replies.

MLHab306

Technical User
Nov 11, 2001
41
US
Hi

I am trying to parameter query by zip code.
Some of my zip codes are 5 digit lengths and some are 9 digits. When I do a parameter query ie 91324 I only get the addresses that match 91324 but not 91324-1234 etc.

I have gone thru the threads searching for zip and did not see any suggestions or past questions. I have tried different wild cards, but with no success.

Thank you

Mark
 
you can use the keyword Like for example

in the criteria of the query (assumming you are using the expression builder)put this

Like Forms!Form_Name!TextBox_With_Zip_Code

This will match the first five characters then anything after else after it.

HTH
 
If you're doing it in the query design grid you could use... Like "*" & [Enter Zip code here] & "*"
 
Mark,

You'll have to watch out for returns of mismatched zips depending on how the data is stored in the table. If the zip code is stored with the hyphen, you should be okay, but an input mask with the hyphen doesn't necessarily store the hyphen even if it is displayed that way.

Watch out for a search criteria of "60607" returning "42606-0734" as a match. Using the wildcard at the end of the statement only:
Code:
([Enter Zip code here] & "*")
should prevent this.


HTH


John

Use what you have,
Learn what you can,
Create what you need.
 
Thanks DumDum

I know thats your screen name but it doesn't sound very good when someone says thank you. Your suggestion of

Like "*" & [Enter Zip code here] & "*"

Worked like a charm.

Thanks again and Happy Holidays
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top