Share via

MS Access calculated field for a Running Balance

Anonymous
2020-01-20T12:13:49+00:00

I have an Access table with fields:

ID

DEBIT

CREDIT

VARIANCE

BALANCE

All fields are numbers.

An Append Query is to append to this table data from another table with fields DEBIT and CREDIT while the query has VARIANCE and BALANCE as calculated fields.

[VARIANCE] = [DEBIT] - [CREDIT] (I have no problem to create an expression for this in the query)

[BALANCE] = [previous BALANCE] + [DEBIT] - [CREDIT] so that this is a running balance.

I need an expression for this calculated field.

Example:

ID          DEBIT         CREDIT         VARIANCE         BALANCE

1           2,000                                2,000                2,000

2              500                                  500                 2,500

3                              3,000           - 3,000                - 500                 

4           1,500             300              1,200                  700

5           2,000                                 2,000               2,700

6           2,000          1,500                 500               3,200

7              300          2,000           - 1,700                1,500

8                                500               - 500                1,000

9                                                         -                  1,000

10         3,000                                 3,000               4,000

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2020-01-20T12:33:52+00:00

Debit balances are computed by summing the debits minus credits for all transactions up to and including the current transaction.  You might like to take a look at Balances.zip in my public databases folder at:

https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169

Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to amend the form design accordingly.  

If you have difficulty opening the link, copy the link (NB, not the link location) and paste it into your browser's address bar.

This little demo file illustrates a number of queries for computing balances.  In my case credit balances are returned, so you'd just need to reverse the sign to compute debit balances.

Was this answer helpful?

7 people found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2020-01-21T14:19:02+00:00

    Thank you, Ken Sheridan.

    I have downloaded your BALANCES.ZIP to study the examples.

    I'm pretty sure to find a solution to my problem.

    Nice day.

    Sam Waniala

    Kampala, Uganda.

    Was this answer helpful?

    0 comments No comments