Filter a Listbox

R

Randy Harris

Is there a way to apply a filter to a listbox that has a query as its
Rowsource?
 
K

Ken Snell

Not directly to the listbox. You need to change the row source of the
listbox to a query that allows you to do the filtering. This query could use
a control on the form to filter its records; the query would contain a
reference (in the "Criteria:" expression) to that control. When you want to
"refilter" the query, you Requery the listbox.

Note that it is possible to change the Row Source programmatically and then
Requery the listbox.
 
R

Randy Harris

Ken Snell said:
Not directly to the listbox. You need to change the row source of the
listbox to a query that allows you to do the filtering. This query could use
a control on the form to filter its records; the query would contain a
reference (in the "Criteria:" expression) to that control. When you want to
"refilter" the query, you Requery the listbox.

Note that it is possible to change the Row Source programmatically and then
Requery the listbox.

Thanks very much Ken. I've taken to manipulating the Row Source
programmatically, I was hoping that there might be a means of applying a
filter, especially if it could be quickly turned on and off.

Randy
 
K

Ken Snell

Only way to turn on and off a filter is to have a criterion in the listbox's
row source query that sees different values as you requery it. Good luck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top