Others

Find the Latest Transaction Date per Equipment ID in Microsoft Access

Phi Hung VoPhi Hung Vo Nov 25, 2026 869 views

Question details

Find the latest transaction date before a specified cutoff for each Equipment ID.

Find the Latest Transaction Date per Equipment ID in Microsoft Access
Product
Microsoft Access
Device & OS
not provided
Scenario
A transaction table contains equipment IDs and dates, and the user needs one latest qualifying date for each ID.
Observed behavior
A query using TOP 1 returns the latest result overall rather than a latest date for every Equipment ID.
Before you start

Check the table and field names in Access, and identify the cutoff date. The example uses Database Table, Equipment ID, and Transaction Date; replace them with your actual names if necessary.

Solution 1Recommended

Filter Transaction Dates Before Grouping by Equipment ID

Use a WHERE clause and MAX to return the latest qualifying date for each equipment ID.

The WHERE clause excludes dates on or after the cutoff before MAX is calculated for each Equipment ID.

1
Open SQL View

In Access, open the database, select Create > Query Design, and switch to SQL View.

2
Enter the grouped query

Enter: SELECT [Equipment ID], MAX([Transaction Date]) AS LatestDate FROM [Database Table] WHERE [Transaction Date] < #2016-06-30# GROUP BY [Equipment ID];

3
Adjust the names and cutoff

In SQL View, replace the table name, field names, and #2016-06-30# cutoff with the values for your database. Keep the date between # symbols.

4
Run the query

Select Run on the query design ribbon to view one latest qualifying date for each Equipment ID.

Filter Transaction Dates Before Grouping by Equipment ID
Dates and IDs excluded: The < operator excludes the cutoff date itself. Equipment IDs with no transactions before the cutoff do not appear in the results.
Free Microsoft Office alternative

Work With Transaction Data in WPS Spreadsheets

WPS Office is a free, lightweight, easy-to-use alternative for working with exported transaction data. Its familiar interface and Microsoft Office format compatibility make it easy to move spreadsheet files between applications. It does not run Microsoft Access database queries.

Review and filter exported equipment transaction data in WPS SpreadsheetsOpen and edit Microsoft Excel XLSX files for easier migrationUse a familiar spreadsheet interfaceWork with a free, lightweight Office alternative
microsoft office alternative - wps office

Frequently Asked Questions

Why shouldn't I use TOP 1 in this query?

TOP 1 limits the overall query result rather than returning one date for each Equipment ID. Use GROUP BY [Equipment ID] with MAX([Transaction Date]) instead.

How do I include transactions on the cutoff date?

If Transaction Date contains time values, use a WHERE condition that is less than the next day, such as [Transaction Date] < #2016-07-01#, to include all times on June 30.

Why is an Equipment ID missing from the results?

An ID is omitted if it has no transaction date satisfying the WHERE condition. Check its dates against the cutoff in the source table.

Does this query return the entire transaction record?

No. The SELECT statement returns the Equipment ID and its latest qualifying date. Returning other transaction fields requires an additional query or join, and tied dates can produce multiple records.