I have an SQL statement in a query called qryCurrentStatus, which is supposed to look up the MAX date and LAST type for records in tblActivity.
SELECT tblActivity.ActivityID, Max(tblActivity.ActivityDate) AS ActivityDate, Last(tblActivity.ActivityType) AS ActivityType
FROM tblActivity
GROUP BY tblActivity.ActivityID
ORDER BY tblActivity.ActivityID, Max(tblActivity.ActivityDate) DESC;
However, there are times when this doesn't seem to work correctly for all records. It appears to pick up the correct date, but the corresponding activitytype is from a different record.
I've removed the query completely and re-entered it, thinking that perhaps that would help, but I get the same results.
Any ideas?
Bluez
SELECT tblActivity.ActivityID, Max(tblActivity.ActivityDate) AS ActivityDate, Last(tblActivity.ActivityType) AS ActivityType
FROM tblActivity
GROUP BY tblActivity.ActivityID
ORDER BY tblActivity.ActivityID, Max(tblActivity.ActivityDate) DESC;
However, there are times when this doesn't seem to work correctly for all records. It appears to pick up the correct date, but the corresponding activitytype is from a different record.
I've removed the query completely and re-entered it, thinking that perhaps that would help, but I get the same results.
Any ideas?
Bluez