468,458 Members | 1,826 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,458 developers. It's quick & easy.

Filtering a listbox

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
2 2909
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
"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.

Similar topics

1 post views Thread by diskoduro | last post: by
1 post views Thread by Greg Smith | last post: by
1 post views Thread by rk | last post: by
4 posts views Thread by John Wildes | last post: by
1 post views Thread by =?Utf-8?B?anAybXNmdA==?= | last post: by
2 posts views Thread by =?Utf-8?B?anAybXNmdA==?= | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.