By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

Filtering a listbox

P: n/a
I have a listbox that is populated with info and when the user selects
categories of things from the list, it brings up detailed items from which
to choose. I want to be able to put a filter on that list that can be
driven by a radio button. The question is, how do I go about this?

I can get a radio button to execute code and the screen to refresh, but I am
not certain about how to build the filter for the list. I populate the
listbox via a query and could set a filter in the initial query process, but
then to turn the filter on and off makes the concept a bit hazy.

Anyone have an idea?
Thanks
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
AFAIK, a listbox doesn't have a separate Filter property, so you'll need to
build your filter into the query which defines the listbox's rowsource.
Suppose you have an option group named gpFilter; optionvalue 1 means to
filter the (numeric) "ID" field by whatever's in the txtID control;
optionvalue 2 means no filter.
You could build your query to include a WHERE Clause like this: (Air code)
ID=Forms!MyForm!txtID OR Forms!MyForm!gpFilter=2

Then all you need to do is to requery the listbox.
Be sure you requery the listbox itself, not the form.

HTH
- Turtle

"Colleyville Alan" <ae***********@nospam.comcast.net> wrote in message
news:eFArc.2271$af3.123570@attbi_s51...
I have a listbox that is populated with info and when the user selects
categories of things from the list, it brings up detailed items from which
to choose. I want to be able to put a filter on that list that can be
driven by a radio button. The question is, how do I go about this?

I can get a radio button to execute code and the screen to refresh, but I am not certain about how to build the filter for the list. I populate the
listbox via a query and could set a filter in the initial query process, but then to turn the filter on and off makes the concept a bit hazy.

Anyone have an idea?
Thanks

Nov 13 '05 #2

P: n/a
"MacDermott" <ma********@nospam.com> wrote in message
news:UP*******************@newsread3.news.atl.eart hlink.net...
AFAIK, a listbox doesn't have a separate Filter property, so you'll need to build your filter into the query which defines the listbox's rowsource.
Suppose you have an option group named gpFilter; optionvalue 1 means to
filter the (numeric) "ID" field by whatever's in the txtID control;
optionvalue 2 means no filter.
You could build your query to include a WHERE Clause like this: (Air code) ID=Forms!MyForm!txtID OR Forms!MyForm!gpFilter=2

Then all you need to do is to requery the listbox.
Be sure you requery the listbox itself, not the form.


Gotcha. Thanks
CA
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.