Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to update subsequent records in a table

Status
Not open for further replies.

irish634

Technical User
Jun 6, 2008
2
US
Hello,

I am trying to create a checkbook type database. I am stuck where if I need to edit a record, I need to update the running balance for the subsequent records but not the previous records.

For example: I have 10 records in a table. If I update a "withdrawal" value in Record 5 which in turn updates the "Balance" for record 5, how do I update the balances in records 6-10 without updating 1-4?

Thanks
 
You could loop thru a recordset beginning with the record after the edit, using UPDATE...SET SQL.

"Time flies like an arrow; fruit flies like a banana."
 
you shouldn't be keeping the running balance in a table, you should calculate it on the fly in a query. This is why you don't store calculate values, breaks the rules of database design.


Leslie

Have you met Hardy Heron?
 
I swore I would never admit this, but Excel does this sort of thing quite nicely.

[flush3]

"Time flies like an arrow; fruit flies like a banana."
 
... but Excel does this sort of thing quite nicely.

Yes it does ... and maybe there's a lesson there.

Access may be a hammer when what you really need is a screwdriver. You can make it work but it isn't the right tool for the job.
 
Hi. I know excel does this quite well.
I want to use a "hammer" as you put it because I want to be able to report more efficiently.

Thanks for the input.
 
Yup

All you need is

Starting Balance
Change (positive or negative)

This cna be run in report to give a current balance per line, or a balance for the report as a whole (or both)

It makes for much easier updating, especially if you need to go back and made a correction.

You can even get a starting balance by getting the user to 'reconcile' the bank account at irregular periods, but this could make for some interesting reporting if the reconcilliation was half way thruogh a reporting period.

SeeThru
Synergy Connections Ltd - Telemarketing Services

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top