Running Sum Within Union Query

S

SteveS

I posted this problem previously, received a solution that I thought would
work but it became too large and received a "Query is too complex" error. So,
I'd like to approach this a different way:

I have created a Union Query to consolidate results from separate queries,
each one of which represents results for a single month:

SELECT ReportMonth, MonthlyRev, MonthlyCost
FROM qryMonth1Total
UNION
SELECT ReportMonth, MonthlyRev, MonthlyCost
FROM qryMonth2Total
UNION
SELECT ReportMonth, MonthlyRev, MonthlyCost
FROM qryMonth3Total;
etc. (for 12 months)

Results show as:
ReportMonth MonthlyRev MonthlyCost
01/01/2007 $5000 $550
02/01/2007 $7500 $400
03/01/2007 $3500 $350
etc.

I would like to add running sum columns to the results as follows:

ReportMonth MonthlyRev MonthlyCost MonthlyRevSum MonthlyCostSum
01/01/2007 $5000 $550 $5000
$550
02/01/2007 $7500 $400 $12500
$950
03/01/2007 $3500 $350 $16000
$1300
etc.

Is this possible in my existing union query? Am relatively new to Access
(just read up on subqueries today) so the simpler the better.
Thanks!
Steve
 

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