473,237 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 software developers and data experts.

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 3612
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
1
by: diskoduro | last post by:
Hi! I'm trying to get help to an unexpected problem that has appeared while I was writing a new application. I want to opeon a report of product sales by filtering previously from a listbox in a...
1
by: Greg Smith | last post by:
Is there a quick and dirty way to filter the lines displayed in a ListBox? Any help is greatly appreciated.
1
by: rk | last post by:
Hi, I need to provide filtering feature for the columns in datagrid. for that I need to provide a drop down arrow image/button in some columns and when that arrow button is clicked, it should...
4
by: John Wildes | last post by:
Hello I have a small program that I've created to generate accounting statements out of our policy managment system. The first part of the process is selecting the customer to create the...
2
by: Zlatko Matić | last post by:
Hello. How to reference selected values from a multi-select list box, as a criteria in a query ? Is it possible at all? Regards, Zlatko
1
by: hackerslacker | last post by:
I have an ordering form that use two combo boxes to filter down the records of a Products table. This worked fine with the after_Update of the first filtering the records and creating the...
1
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a ListBox on my Visual Studio C# form with several entries (14,000). I have to put a search field on the form. As text is entered into the search field, I want the ListBox to remove...
2
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a ListBox on my form with lots of data in it (14000 entries). I have to put a search field on the form. As text is entered into the search field, I want the ListBox to remove entries...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.