Subtract value from one field from another in the same field in another record

  • Thread starter Thread starter kfoll
  • Start date Start date
K

kfoll

Guest
Hi,
I have a query with one field containing dates and another containing number values. What I'd like to do is calculate the difference between the current value in that field and the same field in a previous record, the previous record being the previous date. Then I'd like to calculate the difference between the current value and the initial value (in the first record, earliest date). So I'd have a control for the incremental difference for each record, and another for the conglomerate difference of all the values in that field since the first date.

The end result would look something like this:

Date.......Value.....IncrDiff.....ComDiff:
8/9/04.....250 ......0 .............0
8/18/04...235.......15 ............15
8/24/04...220........15............30

The problem is I can't figure out how to get Access to pick out data from the same field in a previous record. I thought maybe I could use a domain aggregate function but I'm not sure how to write the criteria for the dates previous to the current record. If anyone could point me in the right direction I'd be very grateful.
 
Last edited:
The problem is to get a unique ID for each returned result.

Anyways, i'm also looking into this...
 
Last edited:

Users who are viewing this thread

Back
Top Bottom