Change List Box Row Source using combo box

dntel123

Registered User.
Local time
Today, 17:03
Joined
Feb 23, 2007
Messages
35
Just wondering if it is possible to change a List Box Row Source Using the OnClick Event of a Combo Box.

So for example, I have 4 options in a combo box: And when i click each one in i'd like the Row Source of say 'lstPopulateRecords' to change to a different Query so then it would therefore populate the listbox with another set of records.

Reason for this is my cmdSelectAll button and DeselectAll button are programmed to one List Box, so this method would make the buttons work for all :)

Help is greatly appreciated thanks, Liam
 
Try

Me.ListboxName.RowSource = "YourQueryName"
 
Thanks, ill give it a go and let you know, thanks for the reply :)
 
I've done this a couple times and it works! As pbaldy said you can just do a

Code:
Me.ListboxName.Rowsource = "YourSQLQuery"
me.ListboxName.Requery

Good Luck
 
You don't need the requery line. Setting the row source will effectively requery the combo.
 
Thanks works great, very nice and efficient way of populating list boxes with different tables :)
 

Users who are viewing this thread

Back
Top Bottom