I have some slow running code and I'm trying to bypass the records in the loop causing the code to run slowly. Some of the records take 45+ minutes to calculate. Is there a way to set a timeout, where it will try to calculate the value, but if it doesn't calculate within 30 seconds, move to the next record?
Code:
Public Sub SpeedTest(Rpt As Long)
Dim rs As dao.Recordset
Dim db As dao.Database
Dim b As Date
[TempVars]![tv_currentID] = Rpt
RunSQL "Delete * from SpeedTestT"
RunQuery "SPeedtestMTq"
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM SpeedTestT;")
If Not (rs.EOF And rs.BOF) Then
rs.MoveFirst
Do Until rs.EOF = True
rs.Edit
b = Now()
rs!starttime = b
rs!Equals = Eval(rs![Equation])
rs!ttc = Round((Now() - b) * 24 * 60, 5)
rs.Update
rs.MoveNext
Loop
End If
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
End Sub