Minggu, 11 September 2022

Re: [MSAccessProfessionals] Export to PDF

hi Paco,

no, the extra comma needs to go BEFORE the WhereCondition. In reality, the FilterName parameter is barely used.

syntax:

DoCmd.OpenReport ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs

~ crystal ... more below*

On 9/8/2022 8:45 PM, paco@cellarinfo.com wrote:
Note the extra comma between acViewPreview and strFilter. I think that pushes strFilter to the right position?

previous messages:

~~~

What does strFilter contain?  If it's really a wherecondition, it should be in the next position, like:

DoCmd.OpenReport ctllstReport.Column(0, varItem), acViewPreview, , strFilter, acHidden, strOpenArgs 

Paul
~~~

paco:
I have a VBA function that exports an Access report as a PDF rather than print or preview based on selections on a form. The record source (strFileName), report name (strReportName) and filter (strFilter) are passed to the function from the form. The Preview and Print functionality work fine, but the filter is not applied when outputting to a PDF (even though strFilter contains the proper filer syntax. Any ideas? Thanks in advance.

Private Function Export2PDF (strFileName, strReportName, varItem, strFilter, strOpenArgs) 
    DoCmd.OpenReport ctllstReport.Column(0, varItem), acViewPreview, strFilter, , acHidden, strOpenArgs      'Open the report in preview mode, hidden
    DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strFileName, False
    DoCmd.Close acReport, strReportName
End Function

~~~
* Paco, when you reply, please include previous messages in the thread so those following can keep up, thanks.

how to Quote Post .. Duane uploaded an image on how to quote post in a reply to show previous messages using the web interface here:

https://groups.io/g/MSAccessProfessionals/photo/249167/2977001


kind regards,
crystal

Tidak ada komentar:

Posting Komentar