how do I link a list box to another list box

MIkeD666

Registered User.
Local time
Today, 09:23
Joined
Jan 12, 2019
Messages
62
Hi all, I hope you can help me.
I want to use the selected row in a list box , which has 3 fields in it. CustID, CustADD and CustName.
that will then populate a second list box with invoice details where the custid from a invoice table is = to the custID in the first list box.

So that I have a number of invoice details for the CustID listed in the list box 2

once this is found and then select a row for this listbox to product report showing the invoice details..

The aim is to allow staff to look at a preview list of invoice details of any customer and then select the correct invoice and produce a report showing the full invoice details

Miked666
 
Set the rowsource for listbox2 in the afterupdate event of listbox1 referring to the custid in listbox1. No need for a requery.
Then in listbox2 perhaps use the double click event to open the report and again referring to the invoice ID in the open report command.

 
alternatively if the rowsource is sql code (i.e. not a queryname) you can reference the listbox1 as part of your query e.g.

SELECT *
FROM tblInvoices
WHERE CustID=[listbox1]

then in the change event of listbox1 put 'listbox2.requery'. If your listbox is actually a combobox, then use the afterupdate event instead.
 
Hi all, I hope you can help me.
I want to use the selected row in a list box , which has 3 fields in it. CustID, CustADD and CustName.
that will then populate a second list box with invoice details where the custid from a invoice table is = to the custID in the first list box.

So that I have a number of invoice details for the CustID listed in the list box 2

once this is found and then select a row for this listbox to product report showing the invoice details..

The aim is to allow staff to look at a preview list of invoice details of any customer and then select the correct invoice and produce a report showing the full invoice details

Miked666
Hi thank for the info, I just got time to work on it today. thanks
 
alternatively if the rowsource is sql code (i.e. not a queryname) you can reference the listbox1 as part of your query e.g.

SELECT *
FROM tblInvoices
WHERE CustID=[listbox1]

then in the change event of listbox1 put 'listbox2.requery'. If your listbox is actually a combobox, then use the afterupdate event instead.
Thank for the info, was a great help.
 

Users who are viewing this thread

Back
Top Bottom