A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Strange Problem With DoCmd.OutputTo When Generating a PDF File.



 
 
Thread Tools Display Modes
  #1  
Old April 28th, 2010, 05:01 PM posted to microsoft.public.access.reports
Stewart Berman
external usenet poster
 
Posts: 68
Default Strange Problem With DoCmd.OutputTo When Generating a PDF File.

Stewart Berman wrote:

Access 2007

I have the following code:

On error goto lblError
setupt variable
DoCmd.OutputTo acOutputReport, vRptName, acFormatPDF, vfilename, False
msgbox "Report " & vfilename & " saved."
other code
lblExit:
cleanup code
Exit sub
lblError:
msgbox "Error: " & err.description
resume lblExit
end sub

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:

Debug.Print "OnOpen"
Stop

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
statement.

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?


Bump
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:26 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.