query

  • Thread starter Thread starter pet
  • Start date Start date
P

pet

I need to use access to do the following: HOW???

I retrieve the values A and B from a table, then
calculate A-B, then I need to look at the previous
records' (A-B) value and add it to the current records'
(A-B), hence the current value of (A-B) is a cumulative
sum, i dont want a total, as i want the individual
records the the cumulative sum todate to be presented in
a query.
 
Pet:

This can be done in a query, but it takes a bit to do it. You need to use a
subquery within the query to pull the previous value in to the current row.
If you take a look at our web site in the Code and design tips area, under
queryies you'll find a tip as to how to create an auto number query, which
uses the same subquery concept.

That said, that's more work that its worth. You can do the very same thing
with a report without having the running sum in the query. Simply add two
identical columns for A-B in your query. Then on the report, when you place
the second field for A-B, set its RunningSum properties to yes for the field
and viola you've got a cummunlative sum in the report.

HTH
 
Back
Top