Producing report in PDF format

uplink600

Registered User.
Local time
Today, 20:47
Joined
Mar 18, 2004
Messages
69
Good Morning

The following code (created by Access) produces a report for email and I would like the option to produce the report in PDF format.

Private Sub cmdEmailReport_Click()
On Error GoTo Err_cmdEmailReport_Click

Dim stDocName As String

stDocName = "LiveQuotes"
DoCmd.SendObject acReport, stDocName

Exit_cmdEmailReport_Click:
Exit Sub

Err_cmdEmailReport_Click:
MsgBox Err.Description
Resume Exit_cmdEmailReport_Click

End Sub

Access gives the option to produce the output in various formats such as Excel, HTML, Snapshot etc. Could you please advise if PDF can be included.

Thanks

VC
 
Here is a pc of code I used to print to pdf. Unfortunately I never figured out how to have it save without opening the pdf preview window.

Code:
Private Sub cmdSavePDF_Click()
    On Error GoTo Err_cmdSavePDF_Click
    
    Dim strOriginal As String
    Dim strTestPrinter As String
    Dim stDocName As String
    
    stDocName = "rptExchange"
    
    If MsgBox("Create PDF report?", vbYesNo + vbQuestion, "Report...") <> vbYes Then
        GoTo Exit_cmdSavePDF_Click
    End If
    
    'get default printer
    strOriginal = GetDefaultPrinter()
    
    'set pdf printer
    SetDefaultPrinter ("Adobe PDF")
    
    'see if Adobe Writer is installed
    strTestPrinter = GetDefaultPrinter()
    
    'if Adobe Write is not installed, display a message saying it must be installe to use this feature, and exit routine without printing
    If strTestPrinter <> "Adobe PDF" Then
        MsgBox "Please install Adobe Writer to use this feature.", , "Adobe Writer Error"
        Exit Sub
    End If
    
   'stDocName = "Rpt_Current_FSE_Staffing_List"
    DoCmd.OpenReport stDocName, acNormal
    
    'set the users printer back to their original default
    SetDefaultPrinter (strOriginal)

Exit_cmdSavePDF_Click:
    Exit Sub

Err_cmdSavePDF_Click:
    MsgBox Err.Description
    Resume Exit_cmdSavePDF_Click

End Sub
 

Users who are viewing this thread

Back
Top Bottom