How to Subtract Fields in Microsoft Access Queries to Calculate a Balance
Question details
The user needs to calculate a remaining balance or amount owed by subtracting one field from another using a database query.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Setting up a database to track loans and payments, and needing to calculate the remaining amount owed based on recorded transactions.
- Observed behavior
- The user is looking for the correct way to dynamically subtract payment totals from a loan amount to display an accurate balance.
Ensure your database is properly normalized with separate tables for entities like Employees, Loans, and Payments, connected via Primary and Foreign Keys.
Use a Grouped Query to Calculate the Remaining Balance dynamically
Create a relational query that calculates the balance by subtracting the sum of all payments from the original loan amount instead of storing the result in a table.
In relational database design, it is a best practice to avoid storing calculated fields directly within your tables. If underlying data changes (like a modified or deleted payment), a stored balance will instantly become incorrect.
Instead, use an Access Query to calculate the amount owed on the fly. You can then use this query as the primary record source for your forms and reports.
Create separate tables for 'Employee', 'Loan', and 'Payment'. Ensure the Loan table contains the initial Loan Amount, and the Payment table records individual Payment Amounts with a Foreign Key linking back to the specific Loan ID.
Navigate to the 'Create' tab on the Access ribbon and click 'Query Design'. Add both your 'Loan' and 'Payment' tables to the query workspace.
Click the 'Totals' button (the Sigma icon) in the ribbon's Show/Hide group to allow grouping and summing of records.
Drag the Loan ID and Loan Amount fields into the query grid. Ensure the 'Total' row for these fields is set to 'Group By'.
In an empty column of the query design grid, type the following expression: Balance: [LoanAmount] - Sum([PaymentAmount]). Change the 'Total' row for this specific column to 'Expression', then run the query to view your dynamically calculated balances.

Manage Simple Data and Financial Calculations with WPS Office
While Microsoft Access is powerful for complex relational databases, many users find that tracking loans, recording payments, and running balance calculations is much simpler and faster in a spreadsheet. WPS Office provides a free, lightweight alternative with an intuitive interface and high format compatibility.
- 1. Export your Access data: Open your Microsoft Access database and export your relevant tables to an Excel (.xlsx) file format.
- 2. Open in WPS Spreadsheet: Launch WPS Office and open the exported spreadsheet file.
- 3. Apply subtraction formulas: Use simple subtraction formulas in adjacent columns to instantly calculate remaining balances without needing to build database queries.

Frequently Asked Questions
Why shouldn't I store a calculated balance directly in an Access table?
Storing calculated values violates relational database normalization rules. If any underlying data (such as a past payment) is edited or deleted, the stored balance will not update automatically and will display incorrect information. Queries ensure the balance is always accurate by calculating it on the fly.
Can I do simple subtraction inside an Access table instead of a query?
Microsoft Access does offer a 'Calculated Field' data type in table design for simple row-level math (like Quantity * Price). However, it cannot aggregate or sum related records from another table (such as summing multiple payments against a single loan). For relational aggregation, a query is mandatory.
How do I show the calculated query results on a Form?
Open your Form in Design View, open the Property Sheet, and set the 'Record Source' property to the query you just created. You can then add a text box and set its 'Control Source' to the newly calculated balance field.




