• Re: OutputTo PDF error

    From Rachel Armendariz@21:1/5 to grovelli on Thu Sep 15 08:40:16 2022
    On Monday, June 13, 2011 at 5:48:08 AM UTC-7, grovelli wrote:
    On 11 Giu, 03:25, septimus <ovengra...@yahoo.com> wrote:
    On Jun 10, 8:36 pm, septimus <ovengra...@yahoo.com> wrote:





    On Jun 10, 6:21 pm, "Albert D. Kallal" <PleaseNOOOsPAMmkal...@msn.com> wrote:

    "septimus" wrote in message

    news:49a1b4ae-a663-48a4...@hd10g2000vbb.googlegroups.com...

    When I use the following line of code to publish the report to PDF a >single time, it works:
    DoCmd.OutputTo acOutputReport, "rptIAR", acFormatPDF, strPath

    The above leaves the report open. Place a command to close the report, like
    this:

    DoCmd.Close acReport,"rptIAR"
    DoEvents

    --
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada
    Pleasenospam_kal...@msn.com

    No, sorry, I think the way I phrased that was misleading. The report never opens, so I can't close it using "DoCmd.Close". The first time
    the code loop gets to the OutputTo command it says "Now Outputting 'rptIAR' to the file '[path].pdf'" and goes through all pages of the report before I get the "action canceled" error.

    What I meant when I said "When I use the following line of code to publish the report to PDF a single time it works" is that if I place
    that line of code (the OutputTo command) in a different procedure with
    no loop, it works.

    But in this context, it doesn't even matter what report I'm
    outputting, I still get the "cancel" error. Why does Access think I'm canceling the output?? Here's the code in case it helps:

    'Start looping through records.
    Do While Not rstGrouping.EOF

    'Populate the recordsource of the report.
    PopulateAnswerCounts "Interim", rstGrouping

    'Build the path and file name of the PDF we're producing.
    strPath = BuildFilePath("Interim", Me)

    'Publish the report in PDF format.
    DoCmd.OutputTo acOutputReport, "rptIAR", acFormatPDF, strPath, False

    rstGrouping.MoveNext
    Loop

    Found the problem. Turned out to be just an invalid character in the
    file name. Thanks for your assistance.- Nascondi testo citato

    - Mostra testo citato -
    What's the code for PopulateAnswerCounts and BuildFilePath?
    I am getting the same error and the file name is correct, trying to post a two page pdf in a folder and get the cancel 2501 error. Any suggestions. Works for all other reports except my two page report.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)