wtrimble
asked on
Filtering two listbox with each others Entries
I have two List boxes: listbox0 is Customer name; listbox2 is Plant name. Right now I have it setup where a user selects "clicks" a customer name in listbox0 and in listbox2 the Plant names that are associated with that Customer name will show. Listbox2 is blank until a Customer is chosen in Listbox0.
My problem is that sometimes the user doesn't know the Customer name and only knows the Plant name. So I need to have all Customer names shown in listbox0 and all Plant names shown in Listbox2 until one is selected in either Listbox, where then the other would show the utility name or the list of available plant names.
Right now, for Listbox0 (Customer Names) I have the row source as "SELECT [customer names] FROM [qryprojectnumbers]; [qryprojectnumbers] contains project numbers and Customer name, Plant name...etc. associated with it.
For Listbox2, I have the row source as SELECT [Plantname] from [qryprojectnumbers] WHERE qryprojectnumber.customer = [list0] or [list0] is null
but when nothing is selected in Listbox0, Listbox2 is still empty.
How should I set the query to make all plant names show unless Listbox0 is not null?? and vice versa?
Thanks for the help
My problem is that sometimes the user doesn't know the Customer name and only knows the Plant name. So I need to have all Customer names shown in listbox0 and all Plant names shown in Listbox2 until one is selected in either Listbox, where then the other would show the utility name or the list of available plant names.
Right now, for Listbox0 (Customer Names) I have the row source as "SELECT [customer names] FROM [qryprojectnumbers]; [qryprojectnumbers] contains project numbers and Customer name, Plant name...etc. associated with it.
For Listbox2, I have the row source as SELECT [Plantname] from [qryprojectnumbers] WHERE qryprojectnumber.customer = [list0] or [list0] is null
but when nothing is selected in Listbox0, Listbox2 is still empty.
How should I set the query to make all plant names show unless Listbox0 is not null?? and vice versa?
Thanks for the help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Listbox2.RowSource = "SELECT [Plantname] from [qryprojectnumbers] WHERE qryprojectnumber.customer = [list0]"
should be one line. Is that the problem?
should be one line. Is that the problem?
Private Sub Listbox0_AfterUpdate ()
Listbox2.RowSource = "SELECT [Plantname] from [qryprojectnumbers] WHERE qryprojectnumber.customer = [list0]"
End Sub
ASKER