View Full Version : Balance brought forward


Groundrush
06-12-2002, 04:57 AM
I am trying to keep a running total of money left over after paying money out.
What is the best way to carry the balance over ?

I have a Debit and Credit field and in my query I have typed in Balance:[Credit]-[Debit], which works for the first record
but give a negative value for the rest.

any ideas?

:confused: Thanks

Groundrush
06-12-2002, 06:38 AM
I suppose I should use the Help function in Access more often

I have solved my query by using a running sum...

:D yeepeeeeeee

Jon K
06-12-2002, 09:48 AM
Could you post the query code you are using?

I have been looking for ways of producing running totals in SELECT queries.

What version of Access are you using? When I look up 'running sum' in Access's help, I can find only running sums in reports, not in queries. I am using Access 97.

Thanks

Groundrush
06-12-2002, 03:26 PM
It looks like you can only use the Running sums on a report

I am using Access 2000 and still looking for a solution to the same problem as you.

trying to keep running totals in the Form and query

:( Regards

Rich
06-12-2002, 03:28 PM
Why would you want to do running totals in a query? It's probably the worst place to put one.

Jon K
06-12-2002, 10:39 PM
I see what you mean. But I have to export data to a predefined range in an Excel worksheet held by another department. To do this,I have to use INSERT INTO.

For now, I can only use code or a report to calculate the running total before exporting.

I think it will be much neater if I can do it in the INSERT INTO query.

Pat Hartman
06-13-2002, 08:18 AM
It is MUCH better to create the running sum in the spreadsheet. The usual way to create running sums in a query is by using a DSum() function. To use this method your query needs to include the UNIQUE identifier from the base table. For EVERY row in the recordset a separate query must be run to sum all the previous (by key value) rows. A running sum done in a report or spreadsheet is a simple sequential process and is based on physical row order rather than key values.