Accumulating sums

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Accumulating sums

I have a table with the following with 2 main columns: Year
(2001,2002,2003…) and Value (200,300,400…)

I want to make a query that will sum the value of the actual year plues the
past years like this:

Year Value AccumulatedValue
2001 200 200
2002 300 500
2003 400 900
2004 500 1400

Is there any body to know how to make this query?

Thanks a lot
 
Accumulating sums

I have a table with the following with 2 main columns: Year
(2001,2002,2003…) and Value (200,300,400…)

I want to make a query that will sum the value of the actual year plues the
past years like this:

Year Value AccumulatedValue
2001 200 200
2002 300 500
2003 400 900
2004 500 1400

Is there any body to know how to make this query?

Thanks a lot

It's very easy on a Report: simply bind two textboxes (labeled Value
and AccumulatedValue) to the Value field, and set the Running Sum
property of AccumulatedValue to "Over All".

In a Query, you'll need to use DSum:

SELECT [Year], [Value], DSum("[Value]", "tablename", "[Year] <= " &
[Year]) AS AccumulatedValue;

John W. Vinson[MVP]
 
Hey! John, thanks a lot!!!! You do not know how much you had help me.
Thanks, thanks, thanks...

John Vinson said:
Accumulating sums

I have a table with the following with 2 main columns: Year
(2001,2002,2003…) and Value (200,300,400…)

I want to make a query that will sum the value of the actual year plues the
past years like this:

Year Value AccumulatedValue
2001 200 200
2002 300 500
2003 400 900
2004 500 1400

Is there any body to know how to make this query?

Thanks a lot

It's very easy on a Report: simply bind two textboxes (labeled Value
and AccumulatedValue) to the Value field, and set the Running Sum
property of AccumulatedValue to "Over All".

In a Query, you'll need to use DSum:

SELECT [Year], [Value], DSum("[Value]", "tablename", "[Year] <= " &
[Year]) AS AccumulatedValue;

John W. Vinson[MVP]
 
Back
Top