Hi....I have a Form that I've designed which includes 2 Drop Down Boxes and a Button that will generate an Access Report based on the criteria submitted in the drop downs. The purpose of the 2 Combo Boxes (cboDivAllOFFICES, cboCourse_wDiv) is to filter the Report by Division Name (this is a required selection) and then Course Name (this is optional). Obviously, if the user does not select a course from the second combo box, I want the report to query ALL courses for the selected division.
Based on the query I have thus far, it works when the user selects something from both drop downs; however, If the user leaves the 2nd Drop Down blank (Course Name), the query doesn't work. I'm not sure why, but I'm not having luck with the "Like "*"" syntax in the query if the combo box is blank. I've also tried >0 without success. Now, for testing sake, I did specifically define a course number to use (in place of the Like *, to validate that the query would look for different criteria if the Drop Down was null, and it worked and pulled only the courses defined by that course number.
Any thoughts on why the Like * isn't working?
Based on the query I have thus far, it works when the user selects something from both drop downs; however, If the user leaves the 2nd Drop Down blank (Course Name), the query doesn't work. I'm not sure why, but I'm not having luck with the "Like "*"" syntax in the query if the combo box is blank. I've also tried >0 without success. Now, for testing sake, I did specifically define a course number to use (in place of the Like *, to validate that the query would look for different criteria if the Drop Down was null, and it worked and pulled only the courses defined by that course number.
Any thoughts on why the Like * isn't working?
Code:
SELECT courseID, empNum
FROM qryCourseRequirements_AllCourses2of2
WHERE (((courseID)=IIf([Forms]![ReportsMain]![cboCourse_wDiv]>0,[Forms]![ReportsMain]![cboCourse_wDiv])) AND ((CompletionDate) Is Null)) OR (((courseID)=IIf([Forms]![ReportsMain]![cboCourse_wDiv] Is Null,(courseID) [b][COLOR=red]Like "*"[/color][/b])))
ORDER BY courseName;