Access 2003. I have a form which constantly loops calling another form (Import_Export) every n minutes (parameterised - set to 5 minutes at the moment) to process files which the user has dumped in a folder. It runs happily for days and then eventually crashes on the form open with the message Run-time error 3011. The Microsoft Jet database engine could not find the object ". Debug shows stdocname contains 'Import_export' and stlinkcriteria is "" so it all LOOKS OK. The code loop is shown below. Any ideas welcome - we have been stuck on this for months and have to quit and restart the application once a week to stop it happening.
Private Sub ImpExp_Click()
On Error GoTo Err_ImpExp_Click
'On Error GoTo 0
Dim t0 As Single
Dim dummy As Integer
Me!RunStop = "RUNNING"
Me.Repaint
PressedStop = False
Do While PressedStop = False
Me!WhereFrom = "ImpExp"
stDocName = "Import_Export"
DoCmd.OpenForm stDocName, , , stLinkCriteria
' the above eventually gives message 3011 could not find the object ""
If Me!ErrorNotFound = True Then
PressedStop = True
Me!RunStop = "STOPPED"
Me!ErrorNotFound = False ' so can retry
Else
t0 = Timer
Do While Timer - t0 < PauseSecs
dummy = DoEvents()
' If we cross midnight, back up one day
If Timer < t0 Then
t0 = Timer
End If
Loop
End If
Loop
Exit_ImpExp_Click:
Exit Sub
Err_ImpExp_Click:
MsgBox Err.Description
Resume Exit_ImpExp_Click
End Sub
Any help very gratefully received Thanks
Private Sub ImpExp_Click()
On Error GoTo Err_ImpExp_Click
'On Error GoTo 0
Dim t0 As Single
Dim dummy As Integer
Me!RunStop = "RUNNING"
Me.Repaint
PressedStop = False
Do While PressedStop = False
Me!WhereFrom = "ImpExp"
stDocName = "Import_Export"
DoCmd.OpenForm stDocName, , , stLinkCriteria
' the above eventually gives message 3011 could not find the object ""
If Me!ErrorNotFound = True Then
PressedStop = True
Me!RunStop = "STOPPED"
Me!ErrorNotFound = False ' so can retry
Else
t0 = Timer
Do While Timer - t0 < PauseSecs
dummy = DoEvents()
' If we cross midnight, back up one day
If Timer < t0 Then
t0 = Timer
End If
Loop
End If
Loop
Exit_ImpExp_Click:
Exit Sub
Err_ImpExp_Click:
MsgBox Err.Description
Resume Exit_ImpExp_Click
End Sub
Any help very gratefully received Thanks