For a user to access reports in my db they must select the report and date parameters from the report form filter. In the report form filter there is a combo box where the user can select between reports "Type A" , "Type B", and "Type C".
When the run button is depressed the code runs as such:
If cboReportType =1 Then
DoCmd.OpenReport "Total", acViewPreview, , "Type = 'A'"
ElseIF cboReportType =2 Then
DoCmd.OpenReport "Total", acViewPreview, , "Type = 'B'"
ElseIf cboReportType =3 Then
DoCmd.OpenReport "Total", acViewPreview, , "Type = 'C'"
End If
The report opens with the query qryTestTakers and filters correctly. There is also a Students field on the report that is =DCount("StudentID", "qryStudents"). Both the qryTestTakers and qryStudents contain the StudentID and Type.
I realized that while the report is filtered and displays the proper records the Students field is not filtered and retruns all the records, not just those relative to the type I selected.
Is there a code I can place into the report to filter the Students field to be filtered according to the filter of the report?