Query help - creating chart

O

Opal

I am running Access 2003 and I am trying to create a
query to populate a chart in a report.

I have one table that holds "Concerns" and one that
holds "Countermeasures". There is a one to many
relationship between Concerns and Countermeasures.

I am counting how many concerns are input each
month and how many are closed. The Input date
is in the Concerns table and the closed date is in the
Countermeasure table. I have created the following
queries to count this information for me:

SELECT Count(Concern.ConcernID) AS [Open], Format([C/MTiming],"mm
yyyy") AS MonthYr
FROM Concern
GROUP BY Format([C/MTiming],"mm yyyy");

SELECT Count(Countermeasure.ConcernID) AS Closed,
Format([DateClosed],"mm yyyy") AS MonthYr
FROM Countermeasure
GROUP BY Format([DateClosed],"mm yyyy"), Countermeasure.StatusID
HAVING (((Countermeasure.StatusID)=2));

From there I created 2 subqueries to provide running totals
of opened (Plan) and closed (Actual):

SELECT T1.MonthYr, (SELECT Sum(qryConcernOpenbyDate.Open) as Plan
FROM qryConcernOpenbyDate
WHERE qryConcernOpenbyDate.MonthYr <= T1.MonthYr) AS Plan
FROM qryConcernOpenbyDate AS T1;

SELECT T1.MonthYr, (SELECT Sum(qryConcernClosedbyDate.Actual) as
Actual
FROM qryConcernClosedbyDate
WHERE qryConcernClosedbyDate.MonthYr <= T1.MonthYr) AS Actual
FROM qryConcernClosedbyDate AS T1;

I need to combine this into one query so that I can chart
Plan vs. Actual but a Union query won't do.....

Can anyone offer any advise / assistance? Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top