I have a race timing program.
In certain races, a team of 2 cyclists may ride together as a team.
Both persons will be timed, but only the last person crossing the line's time, must be kept in the database. The first person crossing the line, must be deleted as a duplicate record, if person crosses within 10 min of the last person.
i have tried the following but is stuck now.
Any suggestions please?
[IMGNOTHUMB]http://bytes.com/attachments/attachment/7287d1383493099/deleted-first-record.jpg[/IMGNOTHUMB]
In certain races, a team of 2 cyclists may ride together as a team.
Both persons will be timed, but only the last person crossing the line's time, must be kept in the database. The first person crossing the line, must be deleted as a duplicate record, if person crosses within 10 min of the last person.
i have tried the following but is stuck now.
Code:
Dim rs1 As Recordset Dim myRaceTime As Date, myRaceNo As String, x As Long Set rs1 = CurrentDb.OpenRecordset("RacetimingT", dbOpenDynaset) x = 0 rs1.MoveLast With rs1 Do Until .EOF myRaceNo = !RaceNumber 'racenumber is a numberfield type and of a cyclist myRaceTime = !RaceFinishTime 'the finish time of the cyclists .MoveNext Do Until .EOF If (!RaceNumber = myRaceNo) And _ (DateDiff("n", myRaceTime, !RaceFinishTime) > -10 And _ DateDiff("n", myRaceTime, !RaceFinishTime) < 10) Then .delete End If .MoveNext Loop .MoveLast x = x + 1 .Move x Loop End With rs1.close Set rs1 = Nothing End With
[IMGNOTHUMB]http://bytes.com/attachments/attachment/7287d1383493099/deleted-first-record.jpg[/IMGNOTHUMB]
Comment