>Dear Bhavbhuti Nathwani
>
>No body wrote any code in this thread. Every body try to present suggestions.
>I ask if thread poster knows the codes then what he needs to post any thread.
It's easy to write the code - it's much harder to design the tables (or even temporary cursors) to have as little code as really necessary.
There are several things to consider in your case (and yes, I had my running totals to do in my time). First, can you trust the totals column? Is it possible that a record may come somewhere in the middle and you'd have to recalculate everything from that point on? Is it possible that a record may be deleted (and then recalculate everything again)? Also, are you sure the records will always show in this order? If there's any chance that they may show in a different order, then you'd have to recalculate for the new order.
If it will always be by date, and there is one and only one record per date, then it's simple:
lnTotal=0
lnOpening=0
scan
lnTotal=lnTotal+receipt-payment
replace opening with lnOpening;
, total with lnTotal
lnOpening=lnTotal
endscan
If any record changes (add new, change existing, delete... anything), you would need to run this again.