running sum

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

Guest

I know how to calculate a running sum in a report. Is it possible to chart a
running sum in a form?
 
To perform a running sum in a form it's not as simple as the report, you
don't have the same properties.
You can achieve that using code or a seperate SQL for the field.

The is an answer given in a prev post for the same question

If the records in the form are sorted on some field with unique values, you
could use a calculated control (or a calculated field in the form's
recordsource query) with a DSum function where the value of the field sorted
on is <= to the current.
If there is no field to serve the purpose, you could still do it by means of
a function in VB code, called in each record of the recordsource query. The
function would use a global variable to hold the running sum (and add the
current record's value each time), but you would have to zero out the global
variable before you open the form.
The latter solution (code) looks more complicated, but would run faster in
many cases.

HTH,
Nikos
 
Back
Top