I have two combo boxes in different forms
Combo0 has names of the officers
Combo001 has names of the companies.
I want to use both combo boxes as criteria for the query, the problem i face is that i have to select options in both combo boxes to run the query successfully, i want the query to run with either combo box being empty.
Combo0 has names of the officers
Combo001 has names of the companies.
I want to use both combo boxes as criteria for the query, the problem i face is that i have to select options in both combo boxes to run the query successfully, i want the query to run with either combo box being empty.
SQL:
SELECT [Officers Offsite 1].[Officer Name], [PSC EXAM].[Company Name], [PSC EXAM].[Document Examined], [PSC EXAM].[If other Document Selected], [PSC EXAM].[Type of Examination], [PSC EXAM].[Action if others], [PSC EXAM].[Financial Period], [PSC EXAM].[Company Type], [PSC EXAM].Action, [PSC EXAM].Status, [PSC EXAM].[Action Date], [PSC EXAM].Remarks, [PSC EXAM].[Date of Entry]
FROM [PSC EXAM] INNER JOIN [Officers Offsite 1] ON [PSC EXAM].[Officer] = [Officers Offsite 1].[Officer Name]
WHERE ((([Officers Offsite 1].[Officer Name])=[Forms]![Officerwise]![Combo0]) AND (([PSC EXAM].[Company Name])=[Forms]![Form1]![Combo001])) OR ((([PSC EXAM].[Company Name])=[Forms]![Form1]![Combo001]) AND (([Forms]![Officerwise]![Combo0]) Is Null)) OR ((([Officers Offsite 1].[Officer Name])=[Forms]![Officerwise]![Combo0]) AND (([Forms]![Form1]![Combo001]) Is Null)) OR ((([Forms]![Officerwise]![Combo0]) Is Null) AND (([Forms]![Form1]![Combo001]) Is Null));