Kamis, 08 September 2022

Re: [MSAccessProfessionals] Export to PDF

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

------ Original Message ------
Sent: 9/8/2022 4:27:21 PM
Subject: [MSAccessProfessionals] Export to PDF

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
 

Tidak ada komentar:

Posting Komentar