Hi all,
I have a table with a date/time and a name. If I have a record for example with John as the name and the time is 12:00, can I replace any further instances of John with N/A for the next hour? All I need is the 1st instance of each name for the following hour. I can then filter by excluding N/A to shrink the amount of records in the query.
12:00 John
12:01 Simon
12:03 John (needs to be replaced by N/A)
12:04 John (needs to be replaced by N/A)
12:05 Jack
13:03 John (This can remain as more than 1 hour since the previous instance of the name)
13:05 John (needs to be replaced by N/A as less than 1 hour since the one at 13:03)
The above query would then be 4 records in total instead of 7.
All I have done so far is being able to filter names that are immediately afterwards but not if there any record in the middle
MyName: IIf(DLookUp("[Name1]","Name_Table", "[ID]=" & [ID]-1)=[Name1],"N/A",[Name1])
This works ok but it obviously does not filter all the records I need. Would appreciate if anyone has any suggestions if this is possible.
Thanks in advance.
Gareth
I have a table with a date/time and a name. If I have a record for example with John as the name and the time is 12:00, can I replace any further instances of John with N/A for the next hour? All I need is the 1st instance of each name for the following hour. I can then filter by excluding N/A to shrink the amount of records in the query.
12:00 John
12:01 Simon
12:03 John (needs to be replaced by N/A)
12:04 John (needs to be replaced by N/A)
12:05 Jack
13:03 John (This can remain as more than 1 hour since the previous instance of the name)
13:05 John (needs to be replaced by N/A as less than 1 hour since the one at 13:03)
The above query would then be 4 records in total instead of 7.
All I have done so far is being able to filter names that are immediately afterwards but not if there any record in the middle
MyName: IIf(DLookUp("[Name1]","Name_Table", "[ID]=" & [ID]-1)=[Name1],"N/A",[Name1])
This works ok but it obviously does not filter all the records I need. Would appreciate if anyone has any suggestions if this is possible.
Thanks in advance.
Gareth
Comment