Solved Report will not save as PDF (1 Viewer)

Hamish 237

New member
Local time
Tomorrow, 02:50
Joined
Jun 19, 2019
Messages
16
Hi all would appreciate any advice I'm having issues with saving a report to a path "i'm creating path if its not there" then using the docmd.outputTo to save the file as acformatPDF the path all works fine and saves the file but its not being saved as a PDF just a generic file
now the report works fine and exports in a PDF format to emails no problems at all i have tried both acFormatPDF and "PDFFormat(*.pdf)" as the output format both work for output to an email but will not save the file in a folder as a PDF?? see Code below

DoCmd.OutputTo acOutputReport, "ClaimSUB", acFormatPDF, Application.CurrentProject.Path & "\" & VHID.Column(1) & "\" & "Fault" & "\" & CLID & "\" & CLID, False, , , acExportQualityPrint
the above only saves as a generic file which is then locked if i try to email it as an attachment after saving it shows this
1581079983471.png


I'm i missing something ?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:50
Joined
Feb 19, 2002
Messages
42,970
Looks like you are not populating the file extension. That is how Windows determines which application will be used to open the file. Change your code to this:

Dim strName AS String
strName = Application.CurrentProject.Path & "\" & VHID.Column(1) & "\" & "Fault" & "\" & CLID & "\" & CLID
DoCmd.OutputTo acOutputReport, "ClaimSUB", acFormatPDF, strName, False, , , acExportQualityPrint

This will allow you to put a stop on the DoCmd line so you can examine the file name.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:50
Joined
Oct 29, 2018
Messages
21,358
Hi. I think Pat meant this:

strName = Application.CurrentProject.Path & "\" & VHID.Column(1) & "\" & "Fault" & "\" & CLID & "\" & CLID & ".pdf"
 

Users who are viewing this thread

Top Bottom