Solved

Calculating a running balance

Posted on 2003-11-07
3
1,059 Views
Last Modified: 2009-12-16
How do you calculate a running balance in MS ACCESS Form i.e  if I want to creat a running balance for customer's daily purchase on credit.
0
Comment
Question by:HANKNO
3 Comments
 
LVL 9

Accepted Solution

by:
svenkarlsen earned 50 total points
Comment Utility
if you have the customer account table with e.g. a record for each purchase/transaction:

Table: CustTrans
Fields: CustID, Transdate, TransAmmnt

And then you have another table which sums up the first:

Table: DailyBalance
Fields: CustID, BallDate, BallAmnt

Then you can run a query every day (e.g. at midnight):

INSERT INTO DailyBalance ( CustID, BallAmnt, Balldate )
SELECT CustTrans.CustID, Sum(CustTrans.TransAmnt) AS SumOfTransAmnt, Date() AS CurrDate
FROM CustTrans
WHERE (((CustTrans.Transdate)<Date()))
GROUP BY CustTrans.CustID;


Of course this is just a synopsis, - in the real world you must code the errorhandlers, think about exceptions, probably adapt the query so it can be run at any date (not just current). But it'll get you by for starters, - notice that it gets the Customer list from the trans-table: this means than any client who has made a transaction will be included automatically, - i.e. you don't have to add new clients to the DailyBallance table.


Regards,
Sven
0
 
LVL 39

Expert Comment

by:stevbe
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: svenkarlsen {http:#9704559}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

stevbe
EE Cleanup Volunteer
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now