Hi all,
I have a listbox on my form which initially pulls in data using a query as it's rowsource.
To help with filtering, I have put numerous comboboxes on the form. The comboboxes are populated using data in two other tables.
Once a selection is made, using the SQL in my query mentioned above a set the Listbox rowsource to that of the query as well as the combobox selection on the form.
This is fine, but as I am dealing with Multo Comboboxes, I went further using the same SQL query, and added the form value of the second combobox
Again this is fine, but because of the And operand, I must have a selection in both comboboxes.
How do I cater for blank comboboxes? Therefor, show me all records when I have a selection in the first or second combobox? Basically a Select *
If I change the operand to OR, it will just show me all records based on my selections
I have a listbox on my form which initially pulls in data using a query as it's rowsource.
To help with filtering, I have put numerous comboboxes on the form. The comboboxes are populated using data in two other tables.
Once a selection is made, using the SQL in my query mentioned above a set the Listbox rowsource to that of the query as well as the combobox selection on the form.
Code:
lstDistributionDetails.RowSource = "SELECT tblMain.A_Code, tblA.A_Name, tblMain.ISIN, tblF._F_Code, tblF.F_Name, tblFunds.Type, tblMain.Status FROM tblF INNER JOIN (tblA INNER JOIN tblMain ON tblA.[A_Code] = tblMain.[A_Code]) ON tblF.[ISIN] = tblMain.[ISIN] WHERE ((tblMain.A_Code)=[forms]![frmMain]![cboAgent])"
This is fine, but as I am dealing with Multo Comboboxes, I went further using the same SQL query, and added the form value of the second combobox
Code:
SELECT tblMain.A_Code, tblA.A_Name, tblMain.ISIN, tblF._F_Code, tblF.F_Name, tblFunds.Type, tblMain.Status
FROM tblF INNER JOIN (tblA INNER JOIN tblMain ON tblA.[A_Code] = tblMain.[A_Code]) ON tblF.[ISIN] = tblMain.[ISIN]
WHERE (((tblMain.A_Code)=[FORMS]![frmMain]![cboAgent]) AND ((tblMain.ISIN)=[FORMS]![frmMain]![cboISIN]))
How do I cater for blank comboboxes? Therefor, show me all records when I have a selection in the first or second combobox? Basically a Select *
If I change the operand to OR, it will just show me all records based on my selections