I have a table of items, and a table of transactions on these items. I am trying to find the latest value of a field that is modified in these transactions.
I started by creating a query that selects transactions of a valid type. I then use a second query to find the most recent of these transactions. A third query pulls the field from the most recent transaction.
The problem I'm having is with the second query.
My first version looked like this:
My second version looked like this:
The problem with the first query is that it then makes other queries that display this field non-updatable. The problem with the second query is that it is slow.
Can anybody offer suggestions of how I might better do this?
Thank you.
I started by creating a query that selects transactions of a valid type. I then use a second query to find the most recent of these transactions. A third query pulls the field from the most recent transaction.
The problem I'm having is with the second query.
My first version looked like this:
Code:
SELECT qryUpdates.ItemID, Max(qryUpdates.TransDateTime) AS MaxOfTransDateTime
FROM qryUpdates
GROUP BY qryUpdates.ItemID;
My second version looked like this:
Code:
SELECT tblItems.ItemID, DMax("TransDateTime","qryUpdates","ItemID = '" & [tblItems].[ItemID] & "'") AS MaxOfTransDateTime
FROM tblItems;
The problem with the first query is that it then makes other queries that display this field non-updatable. The problem with the second query is that it is slow.
Can anybody offer suggestions of how I might better do this?
Thank you.