O
Outatym
I am needing to create error handling for my program. I have one main
procedure that runs on a start button. I don't forsee any errors occurring
with the project, but with my type of users, that will most likely be my
downfall. I have decided that error handling will be needed, but the code
will not compile. Keeps giving "Label not Defined" errors. Is there a way
to catch any error witn the procedure, create an email to me which the users
will tell what error code they encountered and where, then terminate the
program? Below is my current code...
Private Sub CmdRun_Click()
On Error GoTo 1227
'
'
' lots of code
'
'
Dialogs(wdDialogFilePrint).Show
PPSPrintForm.Show
ActiveDocument.PrintOut (Background = False)
If Err.Number <> 0 Then
MsgBox "An error has occurred, the program will now terminate and
create an troubleshooting email. The error message number is:" & Error(Err)
DoCmd.SendObject acSendNoObject, , , "(e-mail address removed)"
Err.Clear
Application.Quit
End If
End Sub
procedure that runs on a start button. I don't forsee any errors occurring
with the project, but with my type of users, that will most likely be my
downfall. I have decided that error handling will be needed, but the code
will not compile. Keeps giving "Label not Defined" errors. Is there a way
to catch any error witn the procedure, create an email to me which the users
will tell what error code they encountered and where, then terminate the
program? Below is my current code...
Private Sub CmdRun_Click()
On Error GoTo 1227
'
'
' lots of code
'
'
Dialogs(wdDialogFilePrint).Show
PPSPrintForm.Show
ActiveDocument.PrintOut (Background = False)
If Err.Number <> 0 Then
MsgBox "An error has occurred, the program will now terminate and
create an troubleshooting email. The error message number is:" & Error(Err)
DoCmd.SendObject acSendNoObject, , , "(e-mail address removed)"
Err.Clear
Application.Quit
End If
End Sub