I might try something like the following as the basis for a query that you
could use in a report.
SELECT A.HoundID
, A.TimeScore
, A.Score
Min(B.TimeScore) as PriorTime
FROM TheTable as A LEFT JOIN TheTableAs B
ON A.HoundID = B.HoundID
and A.TimeScore < B.TimeScore
WHERE A.TimeScore between #06:00:00# and #11:00:00#
GROUP BY A.HoundID, A.TimeScore
HAVING DateDiff("n",NZ(Min(B.TimeScore),#00:01:00#),A.TimeScore) > 9
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
> I have a table setup with the following structure
> HoundID pk
[quoted text clipped - 28 lines]
> 10:15 20
> Total 130
Michel Walsh - 28 Apr 2008 16:13 GMT
Unfortunatley, the 09:03 will be a cause to reject the 09:10 record, while
it seems we have to keep the 09:10 record. Nothing in the query 'knows' that
09:03 has been itself rejected and thus, should NOT be considered in any 10
minutes span.
I think the easiest approach would be to LOOP over a recordset ordering the
records by hound and by date_time stamp:
==pseudo code==
actual_hound = rst.Fields("HoundID")
nextValidDateTimeStamp = #00:09:59# +
rst.Fields("DateTimeStamp")
--- do something with the actual record ---
do
rst.moveNext
while ((NOT rst.EOF)
AND actual_hound=rst.Fieds("HoundID")
AND nextValidDateTimeStamp < rst.Fields("DateTimeStamp")
Vanderghast, Access MVP
>I might try something like the following as the basis for a query that you
>could use in a report.
[quoted text clipped - 46 lines]
>> 10:15 20
>> Total 130
John Spencer - 28 Apr 2008 16:41 GMT
Good catch. I'm convinced there should be a way to do this using SQL, but at
present, I don't see the solution.
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
> Unfortunatley, the 09:03 will be a cause to reject the 09:10 record, while
> it seems we have to keep the 09:10 record. Nothing in the query 'knows' that
[quoted text clipped - 19 lines]
>
> Vanderghast, Access MVP