Need help for auto update a running balance in adotable
Posted on 2014-03-13
Hi experts, I feel empty and searching with google was too long without a result I understood.
Perhaps you can help me.
I habe an ADOTable with the Fields 'ID(unique)', 'Date', 'Title', 'Comment', 'Account' and 'amount'.
In a DB Grid I want to complete with one more column named 'balance'. It's no problem, to add this calculation for every row, but then I only get the sum of this row. I would like to get a cumulative result. And if I will later add an entry for an earlier date, all balance should be autoupdtaed like in Excel.
beginning balance := 1000
Date | Title |... amount ... | balance
01.01.2014 |Test1 | .... 100,00 | 1100
05.01.2014 |Test2 | .... -50,00 | 1050
05.02.2014 |Test3 | .... -100,00 | 900
05.02.2014 |Test4 | .... -200,00 | 700
05.03.2014 |Test5 | .... -800,00 | -100
and so on...
Have you some code to rescue me ?