Change list Box Record Souce

JPR

Registered User.
Local time
Today, 10:45
Joined
Jan 23, 2009
Messages
202
Hello,

I have a form with a combo and a listbox. I would like to change the listbox records source depending on the selection of the combo.

The combo's records source is Table1. I have then created two queries that should populate the listbox:

If Me.myCombo.Value = "Clients" Then
Me.mylist.RowSource = "qryClients"
Me.mylist.Requery

Else

me.mycombo.value = "Supplies" Then
me.mylst.rowsource = "Qrysupplies"
End If
End if

Unfortunately the above code is not working.

Appreciate any help with this matter. Thanks
 
Unfortunately the above code is not working.
Doesn't help us to help you. What happens? Does code run? Error mesages?

Where are you using the code?

It may just be a typo but you have "End If" twice
 
If it does not work as you expect, walk through the code line by line in the VBA window with F8 after setting a breakpoint in that code.
 
Thanks you quick reply. Walked through my code and ....yes, it was just a typo with the query name. Thanks
 

Users who are viewing this thread

Back
Top Bottom