P
petdominic via AccessMonster.com
I've created two separate queries, as they pull different date ranges.
Problem is I want to combine the results of these two queries in a report.
When viewing the report I want all the information from both queries to read
left to right by customer. I don't want anyone to scroll to the bottom to
see different date range data but for the same customer. Is there a place I
can put the subreport so that it groups by customer with the other detail of
the main report?
Or do I create a subquery or join query?
Not sure if you need the detail of my queries, but here it is.
Query 1:
SELECT DISTINCTROW [GAM Metric Totals].ID, [GAM Metric Totals].GGP, [GAM
Metric Totals].[Company Name], [GAM Metric Totals].[Headquarter Country],
[GAM Metric Totals].Month, Sum([GAM Metric Totals].GAAP) AS [Sum Of GAAP],
Sum([GAM Metric Totals].Direct) AS [Sum Of Direct], Sum([GAM Metric Totals].
GP) AS [Sum Of GP], Avg([GAM Metric Totals].[Revenue at HQ]) AS [Avg Of
Revenue at HQ]
FROM [GAM Metric Totals]
GROUP BY [GAM Metric Totals].ID, [GAM Metric Totals].GGP, [GAM Metric Totals].
[Company Name], [GAM Metric Totals].[Headquarter Country], [GAM Metric Totals]
..Month
HAVING ((([GAM Metric Totals].Month)>=#9/1/2006# And ([GAM Metric Totals].
Month)<=#8/31/2007#));
Query 2:
SELECT DISTINCTROW [GAM Metric Totals].ID, [GAM Metric Totals].GGP, [GAM
Metric Totals].[Company Name], [GAM Metric Totals].[Headquarter Country], Sum
([GAM Metric Totals].GAAP) AS [Sum Of GAAP], Sum([GAM Metric Totals].Direct)
AS [Sum Of Direct], Sum([GAM Metric Totals].GP) AS [Sum Of GP], Avg([GAM
Metric Totals].[Revenue at HQ]) AS [Avg Of Revenue at HQ], [GAM Program
Details].[Account Plan], [GAM Program Details].[Procurement Guide], [GAM
Program Details].[GAT Meeting Notes], [GAM Program Details].[Client Business
Review], [GAM Program Details].[License Contracts Current], [GAM Program
Details].[GAM Site Exists], [GAM Program Details].[Last Checked]
FROM [GAM Metric Totals] INNER JOIN [GAM Program Details] ON [GAM Metric
Totals].GGP = [GAM Program Details].GGP
GROUP BY [GAM Metric Totals].ID, [GAM Metric Totals].GGP, [GAM Metric Totals].
[Company Name], [GAM Metric Totals].[Headquarter Country], [GAM Program
Details].[Account Plan], [GAM Program Details].[Procurement Guide], [GAM
Program Details].[GAT Meeting Notes], [GAM Program Details].[Client Business
Review], [GAM Program Details].[License Contracts Current], [GAM Program
Details].[GAM Site Exists], [GAM Program Details].[Last Checked], [GAM Metric
Totals].Month
HAVING ((([GAM Metric Totals].Month)>DateAdd("m",-13,Date())));
Thank you all as always for your assistance and patience.
Problem is I want to combine the results of these two queries in a report.
When viewing the report I want all the information from both queries to read
left to right by customer. I don't want anyone to scroll to the bottom to
see different date range data but for the same customer. Is there a place I
can put the subreport so that it groups by customer with the other detail of
the main report?
Or do I create a subquery or join query?
Not sure if you need the detail of my queries, but here it is.
Query 1:
SELECT DISTINCTROW [GAM Metric Totals].ID, [GAM Metric Totals].GGP, [GAM
Metric Totals].[Company Name], [GAM Metric Totals].[Headquarter Country],
[GAM Metric Totals].Month, Sum([GAM Metric Totals].GAAP) AS [Sum Of GAAP],
Sum([GAM Metric Totals].Direct) AS [Sum Of Direct], Sum([GAM Metric Totals].
GP) AS [Sum Of GP], Avg([GAM Metric Totals].[Revenue at HQ]) AS [Avg Of
Revenue at HQ]
FROM [GAM Metric Totals]
GROUP BY [GAM Metric Totals].ID, [GAM Metric Totals].GGP, [GAM Metric Totals].
[Company Name], [GAM Metric Totals].[Headquarter Country], [GAM Metric Totals]
..Month
HAVING ((([GAM Metric Totals].Month)>=#9/1/2006# And ([GAM Metric Totals].
Month)<=#8/31/2007#));
Query 2:
SELECT DISTINCTROW [GAM Metric Totals].ID, [GAM Metric Totals].GGP, [GAM
Metric Totals].[Company Name], [GAM Metric Totals].[Headquarter Country], Sum
([GAM Metric Totals].GAAP) AS [Sum Of GAAP], Sum([GAM Metric Totals].Direct)
AS [Sum Of Direct], Sum([GAM Metric Totals].GP) AS [Sum Of GP], Avg([GAM
Metric Totals].[Revenue at HQ]) AS [Avg Of Revenue at HQ], [GAM Program
Details].[Account Plan], [GAM Program Details].[Procurement Guide], [GAM
Program Details].[GAT Meeting Notes], [GAM Program Details].[Client Business
Review], [GAM Program Details].[License Contracts Current], [GAM Program
Details].[GAM Site Exists], [GAM Program Details].[Last Checked]
FROM [GAM Metric Totals] INNER JOIN [GAM Program Details] ON [GAM Metric
Totals].GGP = [GAM Program Details].GGP
GROUP BY [GAM Metric Totals].ID, [GAM Metric Totals].GGP, [GAM Metric Totals].
[Company Name], [GAM Metric Totals].[Headquarter Country], [GAM Program
Details].[Account Plan], [GAM Program Details].[Procurement Guide], [GAM
Program Details].[GAT Meeting Notes], [GAM Program Details].[Client Business
Review], [GAM Program Details].[License Contracts Current], [GAM Program
Details].[GAM Site Exists], [GAM Program Details].[Last Checked], [GAM Metric
Totals].Month
HAVING ((([GAM Metric Totals].Month)>DateAdd("m",-13,Date())));
Thank you all as always for your assistance and patience.