Getting the count in a report is easy once the report is created. First you have to get the data in a good format for the report. I am imaging a report grouped by DEPARTMENT which will be a HEADER, with the detail of the report listing the complaint comments. In the HEADER you can put the count of the complaints.
So start with the RecordSource of the report. Create a UNION query that's something like below. The name of my table is "TEST; you'll have to tweak the code with your own table and field names:
Code:
SELECT "Dietary Services" AS Department, Test.FoodComplaint as Complaint, Test.FoodComment as Comment FROM Test WHERE (((Test.FoodComplaint)=True)) UNION SELECT "Environmental Services" AS Department, Test.RoomComplaint, Test.RoomComment FROM Test WHERE (((Test.RoomComplaint)=True)) UNION SELECT "Nursing Dept" AS Department, Test.NursingComplaint, Test.NursingComment FROM Test WHERE (((Test.NursingComplaint)=True)) UNION SELECT Test.GeneralDept AS Department, Test.GeneralComplaint, Test.GeneralComment FROM Test WHERE (((Test.GeneralComplaint)=True));
You have to make sure to put each dept name exactly as it is in your table into the code above, i.e spell "Environmental Services" the exact same way it is in your table.
Using this code, my results look like this:
Department Complaint Comment
Dietary Services -1 bad food
Dietary Services -1 bad larry
Dietary Services -1 yuck steve
Environmental Services -1 bad room john
Environmental Services -1 too small
Nursing Dept -1 bad nursing
Nursing Dept -1 larry nursing
Then in the report's Sorting and Grouping, I grouped by DEPARTMENT and made it have a header. Put the field DEPARTMENT in the header and the COMMENT in the detail section of the report. Then in the header, add a text box with this formula:
and it will count the number of comments.
Issues:
1) you have to have the Deptartment that people put in for a "General Complaint" come from a combo box based on your Department table, otherwise if they type in anything they want, it won't group up.
2) you must make the Complaint Comments be REQUIRED, i.e. if someone has a complaint they MUST fill in the Comment field, otherwise blank comments will be counted on your report but the comment will be blank, which kinda defeats your purpose.
Hope this helps. Let us know how it goes.