Hi Gerald,
I am surprised that it did not show anything. I tried it
here and it showed a value, albeit I am not sure if it is
the value that you are after. Give the following a try -
on my machine it gives a running balance from the earliest
transaction date assuming that there is only one row that
has an BeginBal value.
SELECT T1.TransactionDate,
T1.TransactionType,T1.WithdrawAmt,T1.DepositAmt,
T1.InterestAmt,T1.Comment, T1.TransactionSign,T1.BeginBal,
Sum(T3.RunningBalance) As RunningBalance
FROM tblSaveAcct T1,
(SELECT TransactionDate , Sum(DepositAmt + InterestAmt -
WithdrawAmt + BeginBal) AS RunningBalance FROM tblSaveAcct
T2 GROUP BY TransactionDate) T3
WHERE T1.transactionDate >= T3.transactionDate
GROUP BY T1.TransactionDate,
T1.TransactionType,T1.WithdrawAmt,T1.DepositAmt,
T1.InterestAmt,T1.Comment, T1.TransactionSign,T1.BeginBal
ORDER BY T1.TransactionDate DESC;
I'm just not able to get the above code to work correctly, it still does not
want to display the running balance. Not sure why, I tried it several times,
but, it just wouldn't. :\
However, I decided to have a bit of play with it and one from another DB,
and came up with the following combination which does work for whatever
reason, and displays the running balance in proper order;
SELECT T.BeginBal, T.TransactionDate, T.Transaction, T.WithdrawAmt,
T.DepositAmt, T.InterestAmt, T.Comment, (SELECT SUM(Nz(DepositAmt, 0) -
Nz(WithdrawAmt, 0) + Nz(InterestAmt,0) + Nz(BeginBal,0)) FROM tblSaveAcct T1
WHERE T1.TransactionDate < T.TransactionDate
OR (T1.TransactionDate = T.TransactionDate)) AS RunningBalance
FROM tblSaveAcct AS T
ORDER BY T.TransactionDate;
Thank you so very much for all your time and help, I truly do appreciate it.
;-))
Cheers!
Jan
-----Original Message-----
Hi Gerald,
I have changed your SQL to give you a running balance by
transaction date. Have a play with it and see if it works
SELECT T1.TransactionDate,
T1.TransactionType,T1.WithdrawAmt,T1.DepositAmt,
T1.InterestAmt,T1.Comment, T1.TransactionSign,T1.BeginBal,
T3.RunningBalance
FROM tblSaveAcct T1,
(SELECT TransactionDate , Sum(DepositAmt + InterestAmt -
WithdrawAmt + BeginBal) AS RunningBalance FROM tblSaveAcct
T2 GROUP BY TransactionDate) T3
WHERE T1.transactionDate = T3.transactionDate
ORDER BY T1.TransactionDate DESC;
I have copied and pasted your code into an empty query, and tried it with
the form. It seems to work well with all, except that it does not display a
running balance. There is nothing in the RunningBalance when I open the
query or in the control on the form.
Thank you for your time and help with this issue, I really appreciate it
very much.
Jan
-----Original Message-----
Hi all - Access 2002XP - WinME
I have a form based upon the query below. I have a control in which I wish
to display a running balance of all transactions in date order.
I have tried setting the code for the calculations for this as below,
however, what I am getting is not a running balance, but, the same current
total balance displayed for each transaction date.
SELECT tblSaveAcct.TransactionDate, tblSaveAcct.TransactionType,
tblSaveAcct.WithdrawAmt, tblSaveAcct.DepositAmt, tblSaveAcct.InterestAmt,
tblSaveAcct.Comment, tblSaveAcct.TransactionSign, tblSaveAcct.BeginBal,
Sum(Nz([DepositAmt],0)-Nz([WithdrawAmt],0)+Nz([InterestAmt])+([BeginBal],0
)
)
AS RunningBalance
FROM tblSaveAcct
ORDER BY tblSaveAcct.TransactionDate DESC;
I would truly appreciate any suggestions, or a Help or KB article that might
explain how to achieve a running balance for each transaction date.
Jan
.
.