Help: Running Sum (or Cumulative Sum)
I am writing a program in VB6 with ms Access database, and I use VB6 Report designer (without data environment). I need help on how to calculate cumulative sum (or running sum) of a field in the table for each record, and display the resulting sum as a column in the report.
example:
supplierName DateofSupply AmountSupplied
ABC PLC 10/11/2004 2000
Delight Inc. 04/02/2005 5000
Kings International 06/02/2005 1000
Logic Systems 09/02/2005 1500
Horizons Intl 16/02/2005 3000
The intended result should be as shown below:
supplierName DateofSupply AmountSupplied CumulativeSupply
ABC PLC 10/11/2004 2000 2000
Delight Inc. 04/02/2005 5000 6500
Kings International 06/02/2005 1000 7500
Logic Systems 09/02/2005 1500 9000
Horizons Intl 16/02/2005 3000 12000
Please can someone help me out with the code or a sample that does this task.
Thanks in advance.
|