In my database program i use a lot of forms to navigate from one menugroup to another.
For example the code below is fired when the form "frmLeveranciersbeheer" is closed and normaly after closing this form we get back in the form "frmSchakelbord", from where we initially should come when openening the form "frmLeveranciersbeheer".
However,sometimes during development, to gain time , i open this form directly instead of following the normal route via the form "frmschakelbord".
Of course when i close the form i get the errormessage saying that the form "frmschakelbord" isn't found. Until here nothing abnormal. But when i close the message, the whole thing get frozen, and i can't do anything else then trying to leave ms access, and even that can't be done via the normal way. Suddenly i'm out of ms access and have to start it again. After that, sometimes two instances of ms access are active!!
The same problems occures when another error takes place.
What's going on here?
I already reinstalled ms access, because i couldn't find any other reason for this behavior, but that doesn't solved the problem.
See my code below:
Private Sub knpfrmLeveranciersbeheerExit_Click()
On Error GoTo HandleError
Application.Echo False
Me.Visible = False
Forms!frmschakelbord.Visible = True
Application.Echo True
Afsluiten:
On Error Resume Next
Exit Sub
HandleError:
Call HandleError(Err.Number, Err.Description, "knpfrmLeveranciersbeheerExit_Click", "frmLeveranciersbeheer")
Resume Afsluiten
End Sub
Public Sub HandleError(Errnumber As Long, ErrDesc As String, ProcName As String, ModuleName As String)
Beep
On Error GoTo HandleError_Error
Dim strSql As String
strSql = "INSERT INTO tblFoutLog ( FoutNummer, FoutOmschrijving, ProcedureNaam, ModuleNaam ) " & _
"VALUES (" & Errnumber & ", """ & ErrDesc & """, """ & ProcName & """, """ & ModuleName & """);"
CurrentDb.Execute strSql
MsgBox "Er is een fout opgetreden" _
& vbCrLf & "Gelieve nota te nemen van onderstaande informatie m.b.t. de fout. " _
& vbCrLf & "De fout vond plaats tijdens de actie: " & ProcName _
& vbCrLf & "Deze actie bevindt zich in de module: " & ModuleName _
& vbCrLf & "Als foutnummer geldt :" & CStr(Errnumber) _
& vbCrLf & "Deze fout kan als volgt worden omschreven: " & ErrDesc, vbCritical, "Foutmelding"
HandleError_Exit:
Exit Sub
HandleError_Error:
Resume HandleError_Exit
End Sub
For example the code below is fired when the form "frmLeveranciersbeheer" is closed and normaly after closing this form we get back in the form "frmSchakelbord", from where we initially should come when openening the form "frmLeveranciersbeheer".
However,sometimes during development, to gain time , i open this form directly instead of following the normal route via the form "frmschakelbord".
Of course when i close the form i get the errormessage saying that the form "frmschakelbord" isn't found. Until here nothing abnormal. But when i close the message, the whole thing get frozen, and i can't do anything else then trying to leave ms access, and even that can't be done via the normal way. Suddenly i'm out of ms access and have to start it again. After that, sometimes two instances of ms access are active!!
The same problems occures when another error takes place.
What's going on here?
I already reinstalled ms access, because i couldn't find any other reason for this behavior, but that doesn't solved the problem.
See my code below:
Private Sub knpfrmLeveranciersbeheerExit_Click()
On Error GoTo HandleError
Application.Echo False
Me.Visible = False
Forms!frmschakelbord.Visible = True
Application.Echo True
Afsluiten:
On Error Resume Next
Exit Sub
HandleError:
Call HandleError(Err.Number, Err.Description, "knpfrmLeveranciersbeheerExit_Click", "frmLeveranciersbeheer")
Resume Afsluiten
End Sub
Public Sub HandleError(Errnumber As Long, ErrDesc As String, ProcName As String, ModuleName As String)
Beep
On Error GoTo HandleError_Error
Dim strSql As String
strSql = "INSERT INTO tblFoutLog ( FoutNummer, FoutOmschrijving, ProcedureNaam, ModuleNaam ) " & _
"VALUES (" & Errnumber & ", """ & ErrDesc & """, """ & ProcName & """, """ & ModuleName & """);"
CurrentDb.Execute strSql
MsgBox "Er is een fout opgetreden" _
& vbCrLf & "Gelieve nota te nemen van onderstaande informatie m.b.t. de fout. " _
& vbCrLf & "De fout vond plaats tijdens de actie: " & ProcName _
& vbCrLf & "Deze actie bevindt zich in de module: " & ModuleName _
& vbCrLf & "Als foutnummer geldt :" & CStr(Errnumber) _
& vbCrLf & "Deze fout kan als volgt worden omschreven: " & ErrDesc, vbCritical, "Foutmelding"
HandleError_Exit:
Exit Sub
HandleError_Error:
Resume HandleError_Exit
End Sub