Full Version: Openarg With Outputto Workaround Issue
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
kds4evr
Hey Everyone,

I have the following code that returns a report for me:

CODE
       DoCmd.OpenReport "rptExercise", acViewPreview, , , acHidden, 6
       DoCmd.OutputTo acOutputReport, "rptExercise", acFormatPDF, "C:\Documents and Settings\" & UserText & "\Desktop"


I am going about it this way since you cannot use an OpenArg in an OutputTo Cmd. The report will generate and stay hidden. Then I get a popup that shows it is "Printing" the report, or sending it to PDF. However, after that popup the operation stops with "The OutputTo action was cancelled".

Any idea what I am doing wrong. The Report opens the a record count I have based on the argument I pass.

Thank You.
DanielPineault
May I ask you, what is the desired end result your are looking to achieve exactly with your code?

I'm just not understanding the logic behind your actual code to be able to guide you to the proper method to achieve what you are after.
kds4evr
I am trying to save a report in PDF format to the users Destop. The OpenArg is important as the Report is used for several things and the OpenArg sets the count I need to format the Report properly.

This what the OpenArg code looks like in the Report:

CODE
Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
    
Me.GroupFooter1.Visible = Me.ScenarioID = CInt(Me.OpenArgs)


End Sub
kds4evr
Nevermind, I figured it out.

Need a file extension at the end of the desitnation .pdf.

Works like a charm now.

Thank You
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.