How to get combo boxes to list item options NOT all record items (1 Viewer)

vent

Registered User.
Local time
Today, 17:48
Joined
May 5, 2017
Messages
160
Hi everyone,

So I'm trying to follow this report dialogue sample (courtesy of Microsoft Community). On the form "frmMultiFieldDlg_1" is basically exactly what I need. This form filters reports based on two combo boxes and a date range criteria. I made a form similar with a date range and two combo boxes. In the sample, the combo boxes display exactly what's exactly in the table it's referring to. The combo box uses this code:

Code:
SELECT Departments.Department FROM Departments ORDER BY Departments.Department;

I tried doing the same thing, which is as follows:

Code:
SELECT tblAgency.WSIBEmployeeDeclaration FROM tblAgency;

I didn't include an ORDER BY because this drop down is a simple yes/no selection. While this does give me the yes/no options, they're all repeating based on the record selection (e.g. Yes, yes, yes yes, no, yes, no, etc). How do I get this combo box to simple show yes/no and filter based on whichever is chosen? Any advice is much appreciated!
 

Attachments

  • ReportDialogue.accdb
    832 KB · Views: 87

isladogs

MVP / VIP
Local time
Today, 22:48
Joined
Jan 14, 2017
Messages
18,261
So you just want yes / no as the combo box items?

Either change your code to SELECT DISTINCT....
OR use a value list with yes & no
 

Adam Caramon

Registered User
Local time
Today, 17:48
Joined
Jan 23, 2008
Messages
822
Based on your explanation, it sounds like you want a Value list, not a Table/Query for your "Row Source Type."

Then for "Row Source", you would simply type "Yes";"No".

As far as filtering, the reports are based off of queries, which use criteria to refer to the values in the form. You would need to modify the source query to refer to your new combobox rather than the previous department combo box.

As I take a look at the criteria in the query, it is fairly complex (i.e., lots of OR criteria.) If you replace all instances of the department combo box with your new combo box, it should work.

Good luck.
 

Users who are viewing this thread

Top Bottom