Query that sums up all previous lines in a field

Derevon

Registered User.
Local time
Today, 09:08
Joined
Jan 14, 2014
Messages
51
Hello,

I have a query that displays the difference between the number of scanned and processed invoices for each date (invoices scanned minus processed). Now I would like to make a query that for each date based on this shows the total backlog accumulated.

Example table:

The first column contains the date, and the second number of invoices scanned minus invoices processed.

2014-01-02 53
2014-01-03 -15
2014-01-04 24

Would it be possible somehow to make a query that for each lines shows the complete sum of all previous lines?

Based on the above data the result should be:

2014-01-02 53
2014-01-03 38
2014-01-04 62

Or would I have to write some VBA code to create some kind of temp table?

Thanks
 
Try a query along these lines:
Code:
SELECT YourTable.Datum, Sum(YourTable_1.aantal) AS SumOfaantal
FROM YourTable, YourTableAS YourTable_1
WHERE YourTable_1.Datum<=[YourTable].[Datum]
GROUP BY YourTable.Datum;
 
Thanks, namliam. You're a genius. :)
 

Users who are viewing this thread

Back
Top Bottom