tags:

views:

28

answers:

1

I am using following code to generate a print dialogue by using a command button for the report. By using print dialog just by selecting PDF in the printername...changing it to into PDF format.

But I want the report to be converted into PDF directly without prompting print dialog.

Private Sub Wrapper_History_Click()
On Error GoTo Err_Wrapper_History_Click

    Dim stDocName As String

    DoCmd.OpenReport "rptEventLog", acPreview, , _
       "[TrackingNumber] = Forms!frmReviewReleaseWrapper!RevRelTrackingNumber"
    DoCmd.RunCommand acCmdPrint

Exit_Wrapper_History_Click:
    Exit Sub

Err_Wrapper_History_Click:
    MsgBox Err.Description
    Resume Exit_Wrapper_History_Click

End Sub
A: 

For Access 2003 and orlder use A2000ReportToPDF is an Access 2000 database containing a function to convert Reports and Snapshot files to PDF documents. No PDF Printer driver is required. Free.

My understanding in Access 2007 and 2010 is that the built in PDF function works well. Access 2010 no longer has the Snapshot printing capability so you can't use the Lebans solution in A2010.

Tony Toews
All of this assumes you're printing an Access report to PDF. I have often needed to output to Word documents and produce PDFs, and this would be doable in Office 2007/2010, but in Office 2003 and before, a good solution is PDFCreator (http://sourceforge.net/projects/pdfcreator/), which is automatable via VBA (and comes with code samples).
David-W-Fenton