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

AngelSpeaks

Active member
Local time
Today, 01:21
Joined
Oct 21, 2021
Messages
417
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!
 

Josef P.

Well-known member
Local time
Today, 08:21
Joined
Feb 2, 2023
Messages
826
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?
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:21
Joined
Aug 30, 2003
Messages
36,125
And for clarity, Adobe is not required at all for Access to create a PDF with that code.
 

AngelSpeaks

Active member
Local time
Today, 01:21
Joined
Oct 21, 2021
Messages
417
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
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:21
Joined
Aug 30, 2003
Messages
36,125
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.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:21
Joined
May 7, 2009
Messages
19,243
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
 

AngelSpeaks

Active member
Local time
Today, 01:21
Joined
Oct 21, 2021
Messages
417
Right now I'm trying to run this on the old computer. Still waiting for the clunker to start up.
 

AngelSpeaks

Active member
Local time
Today, 01:21
Joined
Oct 21, 2021
Messages
417
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
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:21
Joined
Aug 30, 2003
Messages
36,125
Does that path exist, and can you create a file there? Does the report open manually?
 

AngelSpeaks

Active member
Local time
Today, 01:21
Joined
Oct 21, 2021
Messages
417
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
 

AngelSpeaks

Active member
Local time
Today, 01:21
Joined
Oct 21, 2021
Messages
417
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
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:21
Joined
Aug 30, 2003
Messages
36,125
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