DoCmd.OutPutTo finishes working without an error message RRS feed

  • Question

  • Hi,

    the following code (within Access 2010) worked well for three weeks ... until today ("rptDP" ist the valid name for an existing report and strPDFFile contains a valid Path\PDF-Filename):

        DoCmd.OutputTo acOutputReport, "rptDP", acFormatPDF, strPDFFile

    First I thought, the reason was, that I added a command button in the footer of the report. So I deleted the CB an 'its' code but the program stops executing at the shown program line without any error message.

    I tried

    - shut down an restart Access

    - Compress & Repair the database

    - Change the code into 'DoCmd.OutputTo acOutputReport, "rptDP"' - the program then asked me for the output-format and the path\name of the output-file and ... did nothing but to stop

    - search with Dr. Google and related links within msdn

    - :( @~^%& (censored)

    but nothing worked ...

    You're my last hope!


    Wednesday, June 25, 2014 1:46 PM

All replies

  • Hi again,

    I think, i found the answer within the Thread "Help using vba to send report to pdf":

    Before the command line " DoCmd.OutputTo acOutputReport, "rptDP", acFormatPDF, strPDFFile" I have to open the report by "DoCmd.OpenReport "rptDP", acViewPreview". Maybe acViewHidden will also work, I didn't try.

    I guess, it is one of the big secrets of Microsoft, why the program worked more than three weeks without this construction and then it has suddenly problems ... but, as my grandmother always said: Do not get mad - just wondering!

    Thursday, June 26, 2014 7:30 AM