Others

Create a Multiple-Criteria Running Total with DSUM in Microsoft Access

Tauseeq MagsiTauseeq Magsi Nov 27, 2026 869 views

Question details

Calculate a transaction running total in Access using payroll date and reference number to determine the order.

Create a Multiple-Criteria Running Total with DSUM in Access
Product
Microsoft Access
Device & OS
not provided
Scenario
Transactions are ordered by payroll date, with the smaller reference number first when dates match.
Observed behavior
Each record should show the sum of its transaction amount and all amounts from earlier records in the specified order.
Before you start

Confirm that tblWageworksTEST contains TxAmt, PayrollDate, and a unique numeric RefNum. The expression below assumes PayrollDate contains dates without time values and all three fields are populated.

Solution 1Recommended

Use DSUM with date and reference-number criteria

Use this calculated field to include all earlier dates and, on the current date, records up to the current reference number.

1
Open a query in Design View

In Access, select Create > Query Design and add tblWageworksTEST. Add PayrollDate, RefNum, and TxAmt to the query grid.

2
Add the running total

In a blank Field cell, enter: RunningTotal: DSum("[TxAmt]","tblWageworksTEST","[PayrollDate] < #" & Format([PayrollDate],"mm\/dd\/yyyy") & "# OR ([PayrollDate] = #" & Format([PayrollDate],"mm\/dd\/yyyy") & "# AND [RefNum] <= " & [RefNum] & ")")

3
Set the display order

In the query grid, set Sort to Ascending for PayrollDate and RefNum, with PayrollDate positioned to the left of RefNum. Select Run to review the results.

Use DSUM with date and reference-number criteria
Check the calculation scope: DSUM searches the whole table unless you add matching criteria to its expression. A filter applied only to the query does not automatically restrict the running total.
Free Microsoft Office alternative

Review exported Access transactions in WPS Spreadsheets

WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Office format compatibility. Export your Access query to Excel to review the results in WPS Spreadsheets; WPS does not run Access DSUM queries.

Review exported transaction amounts and running totals in a spreadsheet.Open and edit Microsoft Excel XLSX and XLS files for easier migration.Use a familiar spreadsheet interface in a lightweight office suite.
microsoft office alternative - wps office

Frequently Asked Questions

Why does the DSUM expression use OR between the date conditions?

It includes every record from an earlier payroll date, plus records on the current date whose RefNum is less than or equal to the current RefNum.

Do I need to renumber AutoNumber records after sorting?

No. The expression compares PayrollDate first and uses RefNum only to break ties on the same date. Set both fields to Ascending in Query Design to display that order.

What if PayrollDate contains a time value?

The example assumes date-only values. Remove or account for the time portion before using it; otherwise, equality with the date literal may not match records later in the day.

Why does my total include records hidden by a query filter?

DSUM evaluates tblWageworksTEST independently of the query's filters. Add equivalent conditions to the DSUM criteria if the total should include only the filtered records.