Filtering List Box based on Combo Box selection (1 Viewer)

joshirohany

Registered User.
Local time
Today, 12:57
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

  • Database5.accdb
    636 KB · Views: 292
Last edited by a moderator:

June7

AWF VIP
Local time
Today, 11:57
Joined
Mar 9, 2014
Messages
5,475
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.
 

joshirohany

Registered User.
Local time
Today, 12:57
Joined
Apr 3, 2019
Messages
33
can you make changes in my sample and reshare it. since i tried and it still not working.
 

June7

AWF VIP
Local time
Today, 11:57
Joined
Mar 9, 2014
Messages
5,475
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.
 

joshirohany

Registered User.
Local time
Today, 12:57
Joined
Apr 3, 2019
Messages
33
yes i deleted and recreated still no luck.
 

Attachments

  • Database5.accdb
    704 KB · Views: 290

June7

AWF VIP
Local time
Today, 11:57
Joined
Mar 9, 2014
Messages
5,475
Okay, here is edited file.
 

Attachments

  • Database5.accdb
    424 KB · Views: 301

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 20:57
Joined
Jul 9, 2003
Messages
16,282
where am i going wrong?

Your biggest mistake is you are not communicating very well. It is very difficult to help you if you make a statement like "where am I going wrong" - instead of saying I did this, I did that, I did the other. This happened, that happened and then this happened...

A detailed statement like that provides information for people to work out what's going wrong. A statement like that also demonstrates that you are doing something yourself, and not expecting somebody else to just step in and fix it for you....

Sent from Newbury UK
 

Users who are viewing this thread

Top Bottom