Solved Moved to New Computer, New Version of Access Issue with acFormatPDF (1 Viewer)

AngelSpeaks

Active member
Joined
Oct 21, 2021
Messages
423
I did use Access 2013, just installed Access 2019, on a new computer. My old computer has an old version of Adobe Acrobat Pro, while this computer has Adobe Acrobat Reader (which may be the cause of my problem. Client computer has Acrobat Pro also).

This snippet code is not creating any files (it's in a loop to create a pdf file for each row returned in a query:

Code:
Dim filenamePDF As String
filenamePDF = directoryName & "\State " & gstrState & " Job " & Job & " Start Date " & sDate & " - CP Upload.pdf"

        With DoCmd
            .SetWarnings False
            .OutputTo acOutputReport, "rptAffidavit", acFormatPDF, filenamePDF
            .SetWarnings True
        End With

I didn't find anything that states a specific version of Acrobat is needed and the VBA References are the same.

Thanks for your help!
 
What does the file path look like?
Debug.print filenamePDF
Can you manually create a file under this path?

Why do you need .SetWarnings False?
 
And for clarity, Adobe is not required at all for Access to create a PDF with that code.
 
Hi Josef, thanks for responding. These files were created on the old computer which has Acrobat Pro. A single page PDF for each 'job' in the query results.

.SetWarnings False? Since a lot of VBA code that I looked at had this, I've been using it. When .SetWarnings True, no changes.

1708714582254.png
 
Thanks Paul.
No problem, but pay attention to what Josef suggested doing. Also make sure you can manually open the report after the code has run and failed to create a file. The "usual suspects" are either a bad path or illegal file name, or a data problem that prevents the report from opening.
 
also an alternative to post #2, put the fileNamePDF to msgbox, so you can see and verify if the Path and the Filename is correct.
Code:
Dim filenamePDF As String
filenamePDF = directoryName & "\State " & gstrState & " Job " & Job & " Start Date " & sDate & " - CP Upload.pdf"

'for debugging Only
'remove after
Msgbox filenamePDF
'end of code

        With DoCmd
            .SetWarnings False
            .OutputTo acOutputReport, "rptAffidavit", acFormatPDF, filenamePDF
            .SetWarnings True
        End With
 
Right now I'm trying to run this on the old computer. Still waiting for the clunker to start up.
 
also an alternative to post #2, put the fileNamePDF to msgbox, so you can see and verify if the Path and the Filename is correct.
Code:
Dim filenamePDF As String
filenamePDF = directoryName & "\State " & gstrState & " Job " & Job & " Start Date " & sDate & " - CP Upload.pdf"

'for debugging Only
'remove after
Msgbox filenamePDF
'end of code

        With DoCmd
            .SetWarnings False
            .OutputTo acOutputReport, "rptAffidavit", acFormatPDF, filenamePDF
            .SetWarnings True
        End With
Results with your suggestion: on the new computer. File was not created.

1708716709044.png
 
Does that path exist, and can you create a file there? Does the report open manually?
 
Does that path exist, and can you create a file there? Does the report open manually?
Yes it does. I create an Excel file for the same job in the same path. The name is the same except it has an Excel extension
 
Well I got the clunker to work and all of the files were created and I was able to open up the pdf files. I'm thinking it's some pdf driver. I do have pdf printers on this computer.

The printers are:

1708718317299.png
 
I create PDF's on this computer all day long, printers below. Can you open the report manually? If so try creating a PDF from print preview.

1708718584433.png
 

Users who are viewing this thread

Top Bottom