so i'd being working on an access app, VBA and i need to restart it, the application usually goes stops running when error 3043 or internet connection goes down.. is there any way i can restart this application without having to build another app to check if is running.. thanks
here is the error handling code.

Private Sub Form_Timer()
10      On Error GoTo ErrHandler
20      Form_Main.ctl_Current.Caption = Format(Now, "MM/DD/YYYY HH:MM:SS")
30      If Form_Main.ctl_NextUpdate.Caption = "N/A" Then Form_Main.ctl_NextUpdate.Caption = Format(Now, "YYYY/MM/DD HH:MM:SS")
40      DoEvents

50      If Format(Now, "HH") = "04" And Format(Now, "NN") = "00" And Format(Now, "SS") = "01" Then
            Master.Restart False
'51          RunProcess = Shell("cscript ""I:\DISTRIBU\Quality\RIMData\RIMonkey\RestartKingKong.vbs", vbMinimizedNoFocus)
'52          Quit
53      End If

60      If Format(Now, "YYYY/MM/DD HH:MM:SS") >= Form_Main.ctl_NextUpdate.Caption Then
70          Set db = CurrentDb
80          DoCmd.SetWarnings False
100         If Master.TableCheck("RIMData_RAWProcessing") = True Then db.Execute "DROP TABLE RIMData_RAWProcessing"
120         db.Execute ("RIMData")
130         DoEvents
150         If Master.TableCheck("RIMData_RAW") = True Then db.Execute "DROP TABLE RIMData_RAW"
170         DoCmd.CopyObject , "RIMData_RAW", acTable, "RIMData_RAWProcessing"
180         DoCmd.SetWarnings True
190         DoEvents
200         Form_Main.ctl_LastUpdate.Caption = Format(Now, "YYYY/MM/DD HH:MM:SS")
210         Form_Main.ctl_NextUpdate.Caption = Format(DateAdd("n", 10, Now), "YYYY/MM/DD HH:MM:SS")
220     End If
230     GoTo TEnd

ErrHandler:
Master.ErrMailOut "ErrMsg", "(Form_Main).Timer" & vbNewLine & vbNewLine & "Line Number:" & Erl & vbNewLine & "Err Number:" & Err.Number & vbNewLine & "Err Description:" & Err.Description, Err.Number, Erl
DoCmd.SetWarnings False
Master.Restart False
Resume TEnd

TEnd:
End Sub

Recommended Answers

All 2 Replies

If I remember correctly you can't restart an Access db as the code that is called to do the start part has stopped existing when then db has closed.

I used to use a second db with vba that would open a new instance of the db after x secs - enough time to close the first instance. You could try this or call an external app that would both close and re-start your db. It should be easier that monitoring if Access is running and it would use less resources as well.

yep thanks ^^

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.