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

Apply filter to a query

Status
Not open for further replies.
Sep 21, 2001
28
US
Hello everyone. I would like to know how do I use the apply filter command or macro. I have a generic select query. I would like to be able to apply filter based on what is selected in the combobox. For example, if the user select 'CA' in the combo box, it will filter out all the records w/ california in it. How do I come about doing that?
 
You can supply criteria to a query by the value selected in the combo box. For example, let's say you have a table of addresses. The table has address, city, state, and zip fields. You want to be able to select by state. Set a combo box and use a query to supply the RowSource of the combo box with a list of states. The user selects a state in the combo box. In the AfterUpdate event of the combo box run a query that uses the value selected as criteria.

On the criteria line of the query design grid in the state field place the address of the combo box, like this:

Forms!FormName!ComboBoxName

The query will then look to the combo box and deliver just the records that match the value in the combo box.

Did this answer your question?

Uncle Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top