WalkieTalkie
Technical User
I have a table called tblTransaction. Its fields are TransactionID(Autonumber), TransDate, Amount. I want to get a running balance eg:
TransactionID TransDate Amount Balance
1 1/1/05 10 10
2 2/1/05 6 16
3 3/1/05 -4 12
So simple, yet so difficult to achieve!
I have created a query with an expression to produce the [Balance] column:
This works fine, except for when you want to add a record retrospectively - when ordered by date, the balance isn't right. So then I substituted TransDate for TransactionID, eg:
With this I get a blank column. What am I doing wrong? I've fiddled with the '#' in case its a formatting problem, all to no avail. Is there a better way to do this? It seems like such an obvious thing to want to do, yet I'm having such trouble with it, am I going about it the wrong way?
By the way, I'm using Access 2003.
Any help will be greatly appreciated.
TransactionID TransDate Amount Balance
1 1/1/05 10 10
2 2/1/05 6 16
3 3/1/05 -4 12
So simple, yet so difficult to achieve!
I have created a query with an expression to produce the [Balance] column:
Code:
Balance:DSum("Amount","tblTransaction","TransactionID <= "&TransactionID)
Code:
Balance:DSum("Amount","tblTransaction","TransDate <= # " & TransDate & "#")
By the way, I'm using Access 2003.
Any help will be greatly appreciated.