I use the recordset method to add data to a form called frmchipxc and the table involved is called RaceEntry2. When data is added here, i want to run another function in a subform called "RaceTimingKPSF ".The mainform is called "Racesetupx cf". This function deletes duplicate data added in the last 3 minutes to the same table, called "raceentry2 " after data has been added.
How do i activate/fire this function in the 2nd form as soon as the table (Raceentry2) receives new data via the "frmchipxc" form. I don't want to use the timer function in the subform as the mouse keeps "flickering " on the main form.
Please assist
How do i activate/fire this function in the 2nd form as soon as the table (Raceentry2) receives new data via the "frmchipxc" form. I don't want to use the timer function in the subform as the mouse keeps "flickering " on the main form.
Code:
Dim rs1 As Recordset
Dim myRaceTime As Date, myRaceNo As String, x As Long
DoCmd.SetWarnings False
DoCmd.OpenQuery "DeleteBlankXCEntries"
DoCmd.SetWarnings True
Set rs1 = CurrentDb.OpenRecordset("RaceEntry2", dbOpenDynaset)
x = 0
rs1.MoveFirst
With rs1
Do Until .EOF
myRaceNo = !RaceNo 'racenumber is a numberfield type
myRaceTime = !RaceTime
.MoveNext
Do Until .EOF
If (!RaceNo = myRaceNo) And _
(DateDiff("n", myRaceTime, !RaceTime) > -3 And _
DateDiff("n", myRaceTime, !RaceTime) < 3) Then
.delete
End If
.MoveNext
Loop
.MoveFirst
x = x + 1
.Move x
Loop
End With
rs1.close
Set rs1 = Nothing
'DoCmd.SetWarnings False
[Forms]![Racesetupxcf]![RaceTimingKPSF].Requery
[Forms]![Racesetupxcf]![RaceresultsXCSF].Requery
[Forms]![Racesetupxcf]![SortXcCatSF].Requery
[Forms]![Racesetupxcf]![Rt_editXCSF].Requery
Comment