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

Use a list box to filter a Query?

Status
Not open for further replies.

Wrecker

Technical User
Joined
Aug 29, 2001
Messages
126
Location
US
I have a table with a listbox used to record data. Is there a way to use the same listbox as critria for a filter from a Query created from the table? I would like the user to be able to make a selection from a listbox, and have the query return the data according to the selection made.

Thanks
Wrecker
 
Yes, the easiest way to do this is to go into the criteria section of the query in Design View. Right-click and choose Build.... Then in the list of objects, choose Forms, then the name of your form, and then the name of the list box.

If you are a more technical user, you can substitute the example I use below (just change the names):
Code:
WHERE (MyField1 = Forms!MyForm!MyListBox.Value)

God Bless
Mike ;-)
 
Still not there... It works to filter on all the values in the listbox, But it dosn't bring ip the listbox, so the user can choose a single value to filter on.

Thanks
Wrecker
 
The list box and form will need to have separate underlying queries. Make sure the list box's query matchs the query you created before adding the criteria. God Bless
Mike ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top