From: Stewart Berman on 28 Apr 2010 12:01
Stewart Berman <saberman(a)nospam.nospam> wrote:
>I have the following code:
>On error goto lblError
>DoCmd.OutputTo acOutputReport, vRptName, acFormatPDF, vfilename, False
>msgbox "Report " & vfilename & " saved."
>msgbox "Error: " & err.description
>The report that is being output has an OnOpen event handler that I wanted to
>walk through. I put a breakpoint on the DoCmd.OuputTo statement and then
>hit F8. The report was output without steping through the code in the
>OnOpen event. I then put the following code in the OnOpen event:
>When I again tried to step through the code "OnOpen" was printed in the
>immediate window but the code did not stop.
>If I open the report in print preview mode the code stops at the Stop
>Finally, if an error occurs in the OnOpen code the VB engine acts as though
>the code completed. It does not display an error message and the error
>handler in the calling routine is not invoked.
>It appears as the code that processes the DoCmd.OutputTo acOutputReport to a
>a PDF file is running in Runtime mode and won't allow code to break. That
>would be bad enough but it also appears to bypass error handlers. It
>doesn't even display a runtime error message if there is an error in the
>code -- it just clears the call stack and returns.
>Is there anyway around this bug?
Prev: exporting a report in text - comma delimited format
Next: Suppress Leading Zero