Solved I need running balance including add and less in the report field

Local time
Today, 20:16
Joined
Aug 19, 2021
Messages
212
Hi,
I need help calculating a running balance in a report field. Where the debit will accumulate in the balance and the credit will be subtracted from it.
In the image below my report is getting the "CASH IN HAND" transactions from General Journal and showing the balance from there.
1670486224555.png

I also want to show you these transactions in General Journal Query to more clearify my question, please see the query below which is the source of my report:
1670486750452.png

The output of the balance field in my report that I need is:
1670486962921.png

Kindly guide me on how can I calculate my desired values in my report's balance field.

Thank you.
 
something like:

SELECT VoucherDate, VoucherNo, Account, IIF(Debit<>0, "Cash Received", "Paid") As Narration,
Debit, Credit, (SELECT SUM([Debit]-[Credit]) From yourTable AS T Where T.Account = yourTable.Account And T.ID <= yourTable.ID) As Balance
From yourTable Where Account="Cash In Hand" Order By VoucherDate, ID;

the Total you can calculate on your report.
 
Last edited:
something like:

SELECT VoucherDate, VoucherNo, Account, IIF(Debit<>0, "Cash Received", "Paid") As Narration,
Debit, Credit, (SELECT SUM([Debit]-[Credit]) From yourTable AS T Where T.Account = yourTable.Account And T.ID <= yourTable.ID) As Balance
From yourTable Where Account="Cash In Hand" Order By VoucherDate, ID;

the Total you can calculate on your report.
Dear Arnel thank you for your response.
The error is appearing:
1670491715367.png

Also the Cash Received and Paid etc are just an example of narrations. Narration can be contained in the whole sentence.
 
can you upload a sample data with your journal?
 
Hi Arnel I solved this problem but another problem came up with it. I have calculated the running balance with the help of a subquery, and it also appears in the report.
1670585165632.png
But now when I am trying to get its sum
1670585220175.png

in the report I am getting an error.
1670585277094.png

Please guide me about it.
 
which Report and which Query?
 
to prevent the error, i made another query (AcctLedgerForReport) from AccountLedger.
this new query is the recordsource of the report.

i also made total query (AccountLedger0Total), on the total textbox i just Dlookup() the value on TotalDb, TotalCr of this query.
the balance, just subtract the two textbox.
 

Attachments

If you add the credits and debits together so you have only one column (you can make it very tiny and hide it on the report. You don't need any code or queries, you can use the RunningSum property of a control to show the RunningSum on the report.
 
Last edited:
to prevent the error, i made another query (AcctLedgerForReport) from AccountLedger.
this new query is the recordsource of the report.

i also made total query (AccountLedger0Total), on the total textbox i just Dlookup() the value on TotalDb, TotalCr of this query.
the balance, just subtract the two textbox.
Thank you so much arnel. Its solved.
 

Users who are viewing this thread

Back
Top Bottom