Change list Box Record Souce (1 Viewer)

JPR

Registered User.
Local time
Today, 09:35
Joined
Jan 23, 2009
Messages
192
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
 

bob fitz

AWF VIP
Local time
Today, 17:35
Joined
May 23, 2011
Messages
4,725
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 17:35
Joined
Sep 21, 2011
Messages
14,292
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.
 

JPR

Registered User.
Local time
Today, 09:35
Joined
Jan 23, 2009
Messages
192
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

Top Bottom