In this query I need to report on Volume of cases and Volume of Complications. My problem is I do not know how to add the Complications to the report. I have tried creating a group header for the different complications but that results in the data being placed on the report mixed in with the Volume of cases. I have attached (Statistics) the query output from this query and manually added what I need to add from the query to the report. The second report (Statistics2) is what happens when I create a new header for the SUMofPneuomothorax. Is my problem because these fields are sums?
SQL:
SELECT [Pacer QA tbl].ID, Count([Pacer QA tbl].DateofProcedure) AS CountOfDateofProcedure, [Pacer QA tbl].PacerorICD, [Pacer QA tbl].NewImplantorGeneratorChange, [Pacer QA tbl].TypeofDevice, [Complications qry].DateofProcedure, Sum([Complications qry].Pneumothorax) AS SumOfPneumothorax, Sum([Complications qry].PericardialEffusionTamponade) AS SumOfPericardialEffusionTamponade, Sum([Complications qry].HematomaRequIntervention) AS SumOfHematomaRequIntervention, Sum([Complications qry].Other) AS SumOfOther, Sum([Complications qry].[LeadRevision>TwelveMonths]) AS [SumOfLeadRevision>TwelveMonths], Sum([Complications qry].[LeadRevision<Twelve Months]) AS [SumOfLeadRevision<Twelve Months], Sum([Complications qry].[PocketRevision<Twelve Months]) AS [SumOfPocketRevision<Twelve Months], Sum([Complications qry].[DeviceUpgrade<TwelveMonths]) AS [SumOfDeviceUpgrade<TwelveMonths], Sum([Complications qry].[Infection<SixMonths]) AS [SumOfInfection<SixMonths], Sum([Complications qry].[GeneratorChange<FiveYrs]) AS [SumOfGeneratorChange<FiveYrs]
FROM [Pacer QA tbl] INNER JOIN [Complications qry] ON [Pacer QA tbl].DateofProcedure=[Complications qry].DateofProcedure
GROUP BY [Pacer QA tbl].ID, [Pacer QA tbl].PacerorICD, [Pacer QA tbl].NewImplantorGeneratorChange, [Pacer QA tbl].TypeofDevice, [Complications qry].DateofProcedure
HAVING ((([Pacer QA tbl].PacerorICD)="Pacer" Or ([Pacer QA tbl].PacerorICD)="ICD" Or ([Pacer QA tbl].PacerorICD)="Other"));
SQL:
SELECT [Pacer QA tbl].ID, Count([Pacer QA tbl].DateofProcedure) AS CountOfDateofProcedure, [Pacer QA tbl].PacerorICD, [Pacer QA tbl].NewImplantorGeneratorChange, [Pacer QA tbl].TypeofDevice, [Complications qry].DateofProcedure, Sum([Complications qry].Pneumothorax) AS SumOfPneumothorax, Sum([Complications qry].PericardialEffusionTamponade) AS SumOfPericardialEffusionTamponade, Sum([Complications qry].HematomaRequIntervention) AS SumOfHematomaRequIntervention, Sum([Complications qry].Other) AS SumOfOther, Sum([Complications qry].[LeadRevision>TwelveMonths]) AS [SumOfLeadRevision>TwelveMonths], Sum([Complications qry].[LeadRevision<Twelve Months]) AS [SumOfLeadRevision<Twelve Months], Sum([Complications qry].[PocketRevision<Twelve Months]) AS [SumOfPocketRevision<Twelve Months], Sum([Complications qry].[DeviceUpgrade<TwelveMonths]) AS [SumOfDeviceUpgrade<TwelveMonths], Sum([Complications qry].[Infection<SixMonths]) AS [SumOfInfection<SixMonths], Sum([Complications qry].[GeneratorChange<FiveYrs]) AS [SumOfGeneratorChange<FiveYrs]
FROM [Pacer QA tbl] INNER JOIN [Complications qry] ON [Pacer QA tbl].DateofProcedure=[Complications qry].DateofProcedure
GROUP BY [Pacer QA tbl].ID, [Pacer QA tbl].PacerorICD, [Pacer QA tbl].NewImplantorGeneratorChange, [Pacer QA tbl].TypeofDevice, [Complications qry].DateofProcedure
HAVING ((([Pacer QA tbl].PacerorICD)="Pacer" Or ([Pacer QA tbl].PacerorICD)="ICD" Or ([Pacer QA tbl].PacerorICD)="Other"));