spitzmuller
Programmer
Hi out there
I have a report that - using VBA - is configured based on user input. That input is possibly invalid and then opening the report will throw an error, which I would like to intercept and then let the user know in a decent way. This is the code that I use to try to open the report:
On Error Resume Next
DoCmd.OpenReport Me.Template, acViewPreview
If Err.Number <> 0 Then 'Error has happened
MsgBox "Bummer"
End If
On Error GoTo 0
Works great in some cases. But if the error occurs in the Report_Open-Function of that report, the error does not propagete back to the DoCmd.OpenReport that started it all, instead I get a Debug-Message that I do not want the user to see.
Do I have to implement another Error-Handling in the Report-Open Function or is there a way to propagate the error back to the DoCmd.OpenReport?
Would be great If someone could help me out. Thanks in advance to this great forum Simon
I have a report that - using VBA - is configured based on user input. That input is possibly invalid and then opening the report will throw an error, which I would like to intercept and then let the user know in a decent way. This is the code that I use to try to open the report:
On Error Resume Next
DoCmd.OpenReport Me.Template, acViewPreview
If Err.Number <> 0 Then 'Error has happened
MsgBox "Bummer"
End If
On Error GoTo 0
Works great in some cases. But if the error occurs in the Report_Open-Function of that report, the error does not propagete back to the DoCmd.OpenReport that started it all, instead I get a Debug-Message that I do not want the user to see.
Do I have to implement another Error-Handling in the Report-Open Function or is there a way to propagate the error back to the DoCmd.OpenReport?
Would be great If someone could help me out. Thanks in advance to this great forum Simon