I have numerous subreports in a larger reports. Right now they are sorting by the item of interest name, but I would like to sort by the count of particular items in the reports query.
Here is the query source for one of these:
SELECT [Complaints-Verbal].VerbalComplaintNo, [Complaints-Verbal].DateReceived, [Primary Department Description].PrimaryDepartment
FROM ([Primary Department] INNER JOIN [Complaints-Verbal] ON [Primary Department].VerbalComplaintNo = [Complaints-Verbal].VerbalComplaintNo) INNER JOIN [Primary Department Description] ON [Primary Department].PrimaryDepartment = [Primary Department Description].PrimaryDepartment
WHERE ((([Complaints-Verbal].DateReceived) Between [forms]![frm Report Generator]![cboStartDate] And [forms]![frm Report Generator]![cboEndDate]) AND (([Primary Department Description].PrimaryDepartment) Like [forms]![frm Report Generator]![cboDepartment] & "*"))
ORDER BY [Complaints-Verbal].DateReceived DESC;
Note that the query sorts by DateReceived.
The subreport is grouping by PrimaryDepartment, but I would like to sort it by a calculated control on the subreport, called CountDepartment, whose source is Count([PrimaryDepartment]).
So far I haven't been able to get this to work in the sorting and grouping dialog box. Why? I would show you the groupheader(0) code if I could, but I haven't changed it yet.
Here is the query source for one of these:
SELECT [Complaints-Verbal].VerbalComplaintNo, [Complaints-Verbal].DateReceived, [Primary Department Description].PrimaryDepartment
FROM ([Primary Department] INNER JOIN [Complaints-Verbal] ON [Primary Department].VerbalComplaintNo = [Complaints-Verbal].VerbalComplaintNo) INNER JOIN [Primary Department Description] ON [Primary Department].PrimaryDepartment = [Primary Department Description].PrimaryDepartment
WHERE ((([Complaints-Verbal].DateReceived) Between [forms]![frm Report Generator]![cboStartDate] And [forms]![frm Report Generator]![cboEndDate]) AND (([Primary Department Description].PrimaryDepartment) Like [forms]![frm Report Generator]![cboDepartment] & "*"))
ORDER BY [Complaints-Verbal].DateReceived DESC;
Note that the query sorts by DateReceived.
The subreport is grouping by PrimaryDepartment, but I would like to sort it by a calculated control on the subreport, called CountDepartment, whose source is Count([PrimaryDepartment]).
So far I haven't been able to get this to work in the sorting and grouping dialog box. Why? I would show you the groupheader(0) code if I could, but I haven't changed it yet.