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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query based on Parameters

Status
Not open for further replies.
Nov 9, 2002
9
US
Ok i have a form that i have set up to run my query. this works fine but i need to fine tune how the infomation is obtained.

I want to have a form with many parameters that if info is input into them that all the info is entered you can hit a button and it will search on only the fields with info in them. I can handle making the form

My problem is here
Lets say that i have the following possible input fields

City
First Name
Last Name
Street
Zip Code
Now if i set up a query that has all these fields filled in it will return the one specific thing im looking for
but what if i want to look for say the last name of Doe in ABC city and thats all the info i know and i leave the others blank, when i run my query, i get no results b/c all the field do not have data.
i want it to take the fields i have entered info in and return only the few records that match my criteria.

Thanks in advance for the help
 
Hi

How about using Like instead of equal and use the NZ() function to convert the blank (null) to wild card (*) so make your criteria Like Nz(City,"*") Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Set the criteria in the query to include wild cards. For example, if the criteria for the City field is
[CityEntry]
change it to
Like [CityEntry] & "*"
or
Like "*" & [CityEntry] & "*"

This will allow you to enter a name or leave it blank.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top