Hi,
I have two tables and two lists : CustomerTable, InvoicesTable, CustomerList and InvoicesList. CustomerList displays my Customers and when I click on a row I want in InvoicesList all the invoices related to the customers I clicked on.
I have the following vba code
This code is executed on the event "Click" of "CustomerList". I get the right SQL code and it works if CustomerID is the primary key of the table the second list is queried to. But in that case where customerID is not the primary key of InvoicesTable I do not get anything.
Can someone enlighten me on this topic ?
I have two tables and two lists : CustomerTable, InvoicesTable, CustomerList and InvoicesList. CustomerList displays my Customers and when I click on a row I want in InvoicesList all the invoices related to the customers I clicked on.
I have the following vba code
Code:
SQL = "SELECT [CustomerID] FROM [CustomerTable] Where
[CustomerTable]![CustomerID] <> 0 "
SQL = SQL & "And [CustomerTable]![customerID] like '" & Me.CustomerList & "' "
SQL = SQL & ";"
Me.InvoicesList.RowSource = SQL
This code is executed on the event "Click" of "CustomerList". I get the right SQL code and it works if CustomerID is the primary key of the table the second list is queried to. But in that case where customerID is not the primary key of InvoicesTable I do not get anything.
Can someone enlighten me on this topic ?