Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Totals & Grouping on Reports

Status
Not open for further replies.

tyemm

Technical User
Feb 28, 2005
66
US
I have a report, based on the query below. The report displays some individual totals (specifically, the NYPORTS for a particular sServiceDescription). But I'd like to show additional totals, such as Total of all NYPORTS for a given sServiceDescription, as well as a grand total over all.

The SQL below may be enough (it is for the query underlying the report:


SELECT qryNYPORTSUnion.NYPORTS, Count(*) AS Total, qryNYPORTSUnion.sServiceCode, ClinicalService.sServiceDescription
FROM qryNYPORTSUnion INNER JOIN ClinicalService ON qryNYPORTSUnion.sServiceCode = ClinicalService.sServiceCode
WHERE (((qryNYPORTSUnion.dtReportDate) Between [Forms]![frm NYPORTS Report Generator]![cboStartDate] And [Forms]![frm NYPORTS Report Generator]![cboEndDate]))
GROUP BY qryNYPORTSUnion.NYPORTS, qryNYPORTSUnion.sServiceCode, ClinicalService.sServiceDescription
HAVING (((qryNYPORTSUnion.sServiceCode)="14" Or (qryNYPORTSUnion.sServiceCode)="18" Or (qryNYPORTSUnion.sServiceCode)="21" Or (qryNYPORTSUnion.sServiceCode)="32"));
 
I don't think I know what you are asking for. Do you have some sample records you would like to share?

BTW: your query should probably be:
SELECT qryNYPORTSUnion.NYPORTS, Count(*) AS Total, qryNYPORTSUnion.sServiceCode, ClinicalService.sServiceDescription
FROM qryNYPORTSUnion INNER JOIN ClinicalService ON qryNYPORTSUnion.sServiceCode = ClinicalService.sServiceCode
WHERE (((qryNYPORTSUnion.dtReportDate) Between [Forms]![frm NYPORTS Report Generator]![cboStartDate] And [Forms]![frm NYPORTS Report Generator]![cboEndDate]))
And qryNYPORTSUnion.sServiceCode IN ("14","18","21","32")
GROUP BY qryNYPORTSUnion.NYPORTS, qryNYPORTSUnion.sServiceCode, ClinicalService.sServiceDescription;


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top