473,327 Members | 2,094 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,327 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 3620
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.