Timer event stops working intermittently

DataMiner

Registered User.
Local time
Today, 09:49
Joined
Jul 26, 2001
Messages
336
I have a form with a timer event that is used to run a bunch of stuff on a schedule. I leave this running all the time, and it runs a bunch of code overnight for me. Occasionally this just stops working. I come in in the morning, and nothing at all has run overnight. Usually all I have to do to get it working again is to close and re-open Access.

Has anyone else had this problem?

Does anyone have any idea why this might be happening?
 
Do any errors occur at all?

How do you have the timer set to run? Is it based on a specific time or just after a specific time. If on a specific time, it could be that your computer's CPU was busy when that hit and now that it passed the timer sees it is not that time and goes on.
 
I get no errors, no activity at all. When my stuff runs, it logs to a text file. When this problem occurs, I get nothing logged to the text file.

The time events are based on AFTER a specific time.

In this particular case, I had 15 different events that should've run since I left at 4pm yesterday.

Here's the code that should run every 5 minutes. I've been using this code basically unchanged for more than 10 years. Only recently (past year or so) has this been happening, maybe once a month or so.
Sub MasterSchedule()
Dim DB As Database, RS As Recordset, curtask As String, Tries As Byte
Dim TaskStatus As Variant, FileName As String
If errorhandlingon Then On Error GoTo ErrHandle

logerror "Utilities MasterSchedule starting"
Set DB = CurrentDb
Set RS = DB.OpenRecordset("masterschedulePrioritized", dbOpenDynaset)

RS.MoveFirst
Do Until RS.EOF

If RS!NextSchedTime < Now And InStr(1, RS!SchedWkDay, Weekday(Date)) Then 'if task is due and it's an allowed day of the week
curtask = RS!Task
FileName = Nz(RS!Parameters, "") 'filename is an optional parameter. taskstatus() requires a string, so If null, set to zero length string
RS.Edit
RS!LastStart = Now() 'record start time
RS.Update
'run task
TaskStatus = TaskSuccess(curtask, FileName) 'run the task and report back on results

Set RS = DB.OpenRecordset("masterschedulePrioritized", dbOpenDynaset)
RS.FindFirst "task = '" & curtask & "' and parameters = '" & FileName & "'"
If TaskStatus = True Then
RS.Edit
RS!LastSuccess = Now() 'record success time and increment scheduled time
RS!NextSchedTime = IncrementSchedule(RS!NextSchedTime, RS!SchedWkDay, RS!Interval)
RS!Errors = ""
RS!Tries = 0
RS.Update
Else
RS.Edit
RS!Errors = Left(RS!Errors & " " & TaskStatus, 150) 'record errors
RS!Tries = RS!Tries + 1 're-try
If RS!Tries >= RS!TryLimit Then
RS!NextSchedTime = IncrementSchedule(RS!NextSchedTime, RS!SchedWkDay, RS!Interval)
RS!Errors = RS!Errors & " Gave up after " & RS!Tries & " tries."
RS!Tries = 0

End If
RS.Update

End If
SendAlarm curtask, CBool(TaskStatus), FileName
End If
RS.MoveNext
Loop
GoTo CloseAll
ErrHandle:
logerror "Utilities MasterSchedule Error"


CloseAll:
Set RS = Nothing
Set DB = Nothing
End Sub
 
I realize this is a very old thread, but I'm having the identical problem. Any thoughts? I need to check a directory every minute for XML files exported for a Gas Chromatograph instrument & its software & import them, so I need schedule to run reliably.
 
I realize this is a very old thread, but I'm having the identical problem. Any thoughts? I need to check a directory every minute for XML files exported for a Gas Chromatograph instrument & its software & import them, so I need schedule to run reliably.

Specifiy your exact setup.

1. Is the database split?
2. Is more than one user using the database?
3. If they are, do they have their own copy of the database frontend on their machine?
 

Users who are viewing this thread

Back
Top Bottom