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!

Changing Query Criteria

Status
Not open for further replies.

alexbel

Technical User
Jun 27, 2004
77
US
Hi,

How can I change the criteria of a query? For example, I have a Query called qryQuery1. It has the following fields:

Item ID
Item Author
Item Question
Item Classification

I want the user to have the ability to limit the items by, say, Item Author and Item Classification so I would like to have the query criteria change accordingly.

How can this be achieved?

Thank you
 
In the Criteria row for the query, put something like this:
[Enter Item Author]

Then when the user runs the query, it will prompt them using what you put in the []. Just remember that when you place more than one on the same line, it is the same as saying criteria1 and criteria2 and criteria3...

If you place the on differnt lines, it is saying criteria1 or criteria2 or criteria3...

Hope this helps.
 
But how can I have the criteria change accordingly? Here's what I had in mind. I have two command buttons. One says item author and one says item classification. When the user clicks item author, it prompts them to enter the author of the item (any part, last name or first). If the user clicks item classification, they are asked to input the item classification.

Thank you
 
Create a form based on your query.
Then you can play with the WhereCondition parameter (4th) of the DoCmd.OpenForm method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV's solution is the best for what you want to do. Mine was just for having the user run a query and be able to change the criteria.
 
Actually, you could base your form on the query and then just do a search or filter for the criteria when the user clicks on a button.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top