Filtering List Box based on Combo Box selection

joshirohany

Registered User.
Local time
Today, 12:32
Joined
Apr 3, 2019
Messages
33
Dear all,
Thanks For helping at first. i am trying to update List box based on selection of Combo box.

i am using below code for updating in AFTER UPDATE of combobox.

UG added Code Tags .....
Code:
Option Compare Database
Private Sub Combo14_AfterUpdate()
Dim ListFilter As String
        ListFilter = "SELECT [details].[EName] " & _
                        "FROM details " & _
                        "WHERE [details].[Department] = Forms!Form2.Combo14"
    Me.List18.RowSource = ListFilter
    Me.List18.Requery
End Sub


List box doesn't not update still. attached is the sample.

please help,

Thanks
 

Attachments

Last edited by a moderator:
This is odd - combobox won't hold a value so the SQL receives Null and therefore listbox does not populate. I had to delete the combobox and recreate. And also had to delete and recreate the listbox. Then it all worked.
 
can you make changes in my sample and reshare it. since i tried and it still not working.
 
You tried what - deleting both controls and recreating? The only properties I set were the combobox RowSource and its AfterUpdate event as well as the names for each to agree with code.
 

Users who are viewing this thread

Back
Top Bottom