I am working with a table that records historical transaction data for an ID. The table uses an auto number as the PK. A record is created every time a new action takes place for a particular ID.
I need to create a query to report all records or last record <= to a certain date, but not if there are any transactions after the date. If I create a query that limits the selection just to <= a date, it will output all entries eliminating the future entries.
The table layout is something like this:
Autonumber, ID, Action, Action Date
Sample data:
1, ID1, Action1, 05/12/2004
2, ID2, Action4, 03/28/2004
3, ID1, Action2, 04/18/2004
4, ID2, Action5, 06/30/2004
So if I wanted data based on a date of <= 05/20/2004, it would only return record #1 (or record #1 and #3) for ID1. It would not return any records for ID2, since there was a transaction with a date past the requested date.
Is this possible? Do I need to sort through the entire table storing a single record for the latest date in a temporary table, overwriting it if a later date is found? I think there must be a better and more efficient way to do this.
I need to create a query to report all records or last record <= to a certain date, but not if there are any transactions after the date. If I create a query that limits the selection just to <= a date, it will output all entries eliminating the future entries.
The table layout is something like this:
Autonumber, ID, Action, Action Date
Sample data:
1, ID1, Action1, 05/12/2004
2, ID2, Action4, 03/28/2004
3, ID1, Action2, 04/18/2004
4, ID2, Action5, 06/30/2004
So if I wanted data based on a date of <= 05/20/2004, it would only return record #1 (or record #1 and #3) for ID1. It would not return any records for ID2, since there was a transaction with a date past the requested date.
Is this possible? Do I need to sort through the entire table storing a single record for the latest date in a temporary table, overwriting it if a later date is found? I think there must be a better and more efficient way to do this.