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!

Exporting reports to pdf files 2

Status
Not open for further replies.

itechC

Programmer
Feb 13, 2003
71
0
0
CA
Hello,

I would like to automate the process of exporting my Microsoft access reports to PDF format and have the file saved in a specific location. I over 30 reports so its taking some time to print each one as a pdf and save the file. Any help would be appreciated.

Thanks
 
You will need pdf writer (not the free reader). We use 3rd party software from ACG; you can also purchase the SDK from Adobe if you want to write your own code.

"No matter what happens, somebody will find a way to take it too seriously."
 
I have adobe Acrobat 8.0 that writes pdf's already installed. I need to automate the process of printing each report and saving it at a specific location.
 
Cool! So what did you find when you visited and also looked into the Acrobat SDK?

"No matter what happens, somebody will find a way to take it too seriously."
 
If you have Office 2007, you can do this by installing the free XPS and PDF export addon from Microsoft, then using

DoCmd.OutputTo acFormatPDF

and specifying the filenames - this can be coded to pick it up from other files.

One caveat - to restrict the report to only display specific values, you need to use an underlying query or control on the form to restrict display to only the record(s) you want by using the

=Forms!Someform.Form!txtSomeTextbox

notation

John
 
Do you Run all 30 reports at the same time, or do you run them one at a time. Are you using a form or are just writing all code in VB. Do you know how you want to automate,either thru a macro or a scheduler?
 
Thanks everyone for your replies. I finally got it working. Cheers
 
Hi!
I went to this website and found nothing that can be used. It seems outdated.

I am having a form and PDF Distiller.
When I click the button - Report comes up and I want it to be gone into pdf and saved into C:\

Sometimes parameters will be chosen and Report will come up blank - than I would like to see the message saying 'Report contains no data, please, choose correct Parameters'.

I am using Access2003, thanks so much!
 
Can anyone please, help on this one.
I am hitting the wall with my head.
I need to have Distiller Pring each Report and save in C:\ for an example, thanks to all
 
Google ACG mail & pdf library. It is a third party tool that will enable you to do what you want. Code samples included.

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
It seems like I am suppose to buy something.
However I use to use simple function to print to pdf.
I have Distiller installed and it is all I use to need.
I had been reading online for hours now. Nothing simple comes my way. I can't believe it!

I am looking for something like this:

Dim PDFObj As New PDFClass

With PDFObj
.ReportName = "My Report"
.OutputFile = "c:\copy\test.pdf"
.PrintImage
End With

Set PDFObj = Nothing
 
Nice - that's exactly the code from the library.

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
Here is something I really like:

Dim objPDF as PdfDistiller,strRepName as String,strCustomRepName as String, strPath as String, intRetvalue as Integer

strRepName="Inventory"

strPath="C:\PDFFILEs\"

strCustomRepName="Inventory_Report__Month_May"

Set Application.Printer=Application.Printers("Adobe PDF")

set objPDF = New PdfDistiller

intRetValue=objPDF.FileToPDF (strRepName,strPath & strCustomFileName & ".pdf","")
******************************************
Sub Generate_PS(strReportName as String) ' Generates a post script file

DoCmd.OpenReport strReportName,AcViewPreview
SendKeys "%Fp%l~" & strpath & strReport & ".ps~",True
DoCmd.Close acReport,strReportName

End Sub
*******************************************

I am however getting an empty Distiller file.
 
Have a look at the Application.Printer property in the access VBA help.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,
I have.
You mean like this
Reports("strReport").Printer = Application.Printers("Adobe Distiller")

I thought I won but now at the last version of the Acrobat - there is no Distiller showing at Printer menu.
So I had changed it to
Reports("strReport").Printer = Application.Printers("Adobe PDF")
but I am not sure that now Adobe PDF working as Distiller use to because I do not have output still.

It is a nightmare.
Can anyone help me?

thanks
 
Version 7 and after, Acrobat Creator IS Distiller.

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
Do you have to use that format. You could just publish the PDF by using somthing like this:
Set objPdfPub = objImpRep.PublishPDF
objPdfPub.Publish (strFile) & ".pdf
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top