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

Need help with multiple parameter query

Status
Not open for further replies.

Techdawgs

Programmer
Nov 12, 2004
14
US
I have a table with the following fields:
Name, Occupation, Department, Location

I have a form for the user to select the criteria for the query. My problem is sometimes the query will be based on 1 field (either occupation or department) or multiple fields (occupation and location or department and location). I have no problem pulling data from the form to use in the query, but I run into a problem when the field is left blank. Any suggestions?
 
The basic idea is to play with something like:
OR [Forms]![name of form]![name of textbox] Is Null

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I had a similar issue and what I did was use (credit for this goes to PHV):

Like Nz([Forms]![name of form]![name of textbox],"*")

for each of the fields in my form that I might be filtering records by. It says that if the specific textbox is blank then pull all the records; otherwise pull only the records matching the specified criteria.

Again, you can use that for each field in your query you want to filter by and its corresponding text box.

HTH,
Collen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top