checkbox - listbox

bluwind

Registered User.
Local time
Today, 13:44
Joined
Mar 20, 2008
Messages
26
o.k i have a list box that lists all the records in my database
i have a checkbox which when clicked i want that when clicked all the records in the database that are out of date are not show.

Now i have written the query and tested it independently it works great. i was just wondering if someone could tell me how i can make it so that when i click the check box the query is applied to the list.
 
Use the "on update" event to alter your listbox...
 
O.k this may sound really stupid but how.
i tried a few things including the apply filter meathod.
 
You cannot apply a filter to a listbox...

If someone clicks the checkbox then your code needs to change the query that feeds the Listbox.
 
well i dont know how to do that yet, so instead of wasting anyones time here i will go away and experiment..lol
 
Well you allready have the alternative query right? And I am feeling good today so lets do a little Programming 101...

In design view of the form...
Right click the check box => Properties
Go to the "Event" tab
Find the "On Click" event or you can use the "After change" event
Now there should be a button with 3 dots in it, click on that
Choose "Code Builder"
You just made an event trigger... Now you need to tell this trigger what to do...
Which is replace your query feeding the box.

Some code like
If Me.ChkBox = true then
me.listbox.rowsource = "query1"
else
me.listbox.rowsource = "query2"
endif

should do the trick...
 

Users who are viewing this thread

Back
Top Bottom