I'm having trouble with exporting report to a PDF file. This error happens only on newly installed PC and fresh installation of Office 2016. On two other machines (same version of Office, same database, different paths), everything works as expected. I have tried checking regional and language settings, format options, and everything looks the same.
Dim reportName As String
Dim filePath As String
reportName = "ReportK no " & Forms!frmSales!ID & " - " & Forms!frmSales![Name] & " - " & Forms!frmSales!SaleDate
filePath = Application.CurrentProject.Path & "\reportK\" & reportName & ".pdf"
DoCmd.OpenReport "ReportK", acPreview, , "[ID]= forms![frmSales]![ID]", acHidden
DoCmd.OutputTo acOutputReport, "ReportK", acFormatPDF, filePath, True, acExportQualityPrint
DoCmd.Close acReport, "ReportK", acSaveNo
If I check reportName and filePath with msgBox, it looks OK. If I test DoCmd.OpenReport (without acHidden, and two last lines commented out), it correctly displays preview in access. If I continue with print option from access (and choose Microsoft Print to PDF), it saves correctly. User has full permissions to save at designated folder.
Any help is appreciated.
Dim reportName As String
Dim filePath As String
reportName = "ReportK no " & Forms!frmSales!ID & " - " & Forms!frmSales![Name] & " - " & Forms!frmSales!SaleDate
filePath = Application.CurrentProject.Path & "\reportK\" & reportName & ".pdf"
DoCmd.OpenReport "ReportK", acPreview, , "[ID]= forms![frmSales]![ID]", acHidden
DoCmd.OutputTo acOutputReport, "ReportK", acFormatPDF, filePath, True, acExportQualityPrint
DoCmd.Close acReport, "ReportK", acSaveNo
If I check reportName and filePath with msgBox, it looks OK. If I test DoCmd.OpenReport (without acHidden, and two last lines commented out), it correctly displays preview in access. If I continue with print option from access (and choose Microsoft Print to PDF), it saves correctly. User has full permissions to save at designated folder.
Any help is appreciated.