Filtering two listbox with each others Entries
Posted on 2009-12-16
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