Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Report To Adobe PDF (Not the Standard Question) 2

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
0
0
US
Searching through these threads one can find many different sets of code which can be used to convert an Access report to Adobe PDF. However, all of this code appears to apply only to pre-v6 versions of Acrobat. I can't find any code for Adobe Acrobat v6.

VBA code used in pre-v6 involved registry changes neccessary for setting default save locations and for toggling off/on the option to view a PDF once it was printed. My understanding with Acrobat6 is that it no longer uses registry keys to these purposes. Does anyone know how to work with these values if they do not exist in the registry? Better yet, anyone have any code which will convert an Access report to Adobe PDF in Acrobat6?

Thanks.

--
Mike
 
Mike,

I am using Acrobat 6.0 Professional.

this is the code that I use to dump reports into PDF format.

Yes.. it's simple.

When I use this method ADOBE uses the Report Caption as the name for the export file. So just before I call the procedure I edit the Reports.caption to the file name that I would like to export.

In the form I call this>

'Set the Caption name of the Report.
DoCmd.OpenReport "rptTicketsDetailedlob", acDesign
Reports![rptTicketsDetailedlob].Caption = "Summary_Report_" & Format(Date, "MM_DD_yy") & ".PDF"
DoCmd.Save
DoCmd.Close acReport, "rptTicketsDetailedlob"

'Call the function to print it out.
Call PrinttoPDF("rptTicketsDetailedlob", "D:\test.pdf")


--------

'Here is the function.

Public Function PrinttoPDF(rptname As String, outputfname As String) As String

Set Application.Printer = Application.Printers("Adobe PDF")
DoCmd.OpenReport rptname, acViewNormal
Application.Printer = Nothing

End Function

Initially I was trying to pass an output filename, so the procedure is currently setup to pass that parameter.. but it never seemed to take. That's when I realized that the output file name always seems to be the '.Caption' property of the report.

Good Luck,

I hope this helps.

Kramerica
 
Kramerica,

Thank you for this great info! One question - When I use this code it still prompts me to select a file name and location when creating the PDF. Should not this be automated? Thanks again.

--
Mike
 
Mike,

If you don't want to see the prompt to select file name and path, you can change the setting of the Acrobat Distiller printer. Go to control panel, then printer, right click on Acrobat Distiller, Properties. In TAB Ports, you can set the file path; in TAB General, Printing Preferences, Adobe PDF Setting, uncheck the Prompt for the PDF filename.

James

 
I tried the above code and it is telling

at this line of code

Set Application.printer = Application.printers("Adobe PDF")

printers part of application. comes back with a compile error - method or data memeber not found. I am missing something here. Thanks.
 
Bridget,

Look at the printers that you have installed.

What is the name of your PDF Printer? It may be "Adobe PDFWriter"?

See what you have it setup as on your system.

Kramerica
 
I've looked for this function, off and on, for weeks. Thanks.

George
 
I have the same issue as Bridget. Compile error: Method or data member not found. It highlights the '.Printers' right before '("Adobe PDF")'. I checked my printer settings, and it's called Adobe PDF. Any thoughts?
 
I just found this thread and I'm trying to adapt it to a project.

I have inserted the code suggested by kramerica and I to am have problems with the line "Set application.printer = application.printers("Adobe PDF")".

I have Acrobat Distiller.

Can anyone come up with a suggestion or solution to the above?

Any help would be appreciated.

 
Same problem as mentioned before - cannot find the Set application.printer=...

Any luck?
 
To trScott:

None.

I finally restructured my procedure to manually go in and set the default printer to the distiller.

It is a limited application so its no big deal. It would be convienent if I could get it to work.

It almost sounds like there's a reference that's not being added in but I don't know what it would be if indeed its that.

I still hope there's a solution to it.
 
This only work if you have Access 2002 (XP) and above.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top