View Full Version : Cummulative Sum


aqif
08-02-2001, 11:02 PM
Hi http://www.access-programmers.co.uk/ubb/smile.gif

I am trying to work out a query but dont seem to find the suitable logic. Lets look at my exiting output from query

Select Or_Date, Sum(Or_Amount) As Sum_Amount from MyTable group by Or_Date;

Or_Date Sum_Amount
---------------------------
1-1-2001 25
2-1-2001 20
3-1-2001 45

and so on......now I want the cummulative sum in the next colum like accountants do in thier accounts:

Or_Date Sum_Amount Cummulative_Sum
---------------------------------------------
1-1-2001 25 25
2-1-2001 20 45
3-1-2001 45 90

Thanx in advance

Cheers!
Aqif

Rich
08-02-2001, 11:35 PM
You can only do running sums effectivly if you have a sequentialy ordered ID field. The most efficient way is to use a form or report to display the result and not a query.
Look up running sum in help for various methods.
HTH

Ron Bell
08-03-2001, 06:48 AM
or use a module level VBA to do sums via a recordset based on the query?