Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Output Report in PDF Format with Customized File Name

$
0
0
Hello,

I am trying to output a report using DoCmd.OutputTo with a customized file name based on a control on a form that is open. Not only can I not get my code to work, but my output goes to the printer! My intention is not to print the report but to save it as a pdf file with a filename that is customized and then have adobe reader automatically open the report for viewing. Please see my code below:


Private Sub Command8_Click()
On Error GoTo Err_Command8_Click

Dim OutputFileName As String

OutputFileName = "All_Queries_by_Study_And_Site" & Me.Combo4 '

DoCmd.OpenReport "All_Queries_by_Study_And_Site", acViewNormal, , , acWindowNormal
DoCmd.OutputTo acOutputReport, "All_Queries_by_Study_And_Site", acFormatPDF, OutputFileName, True, , , acExportQualityPrint

Exit_Command8_Click:
Exit Sub

Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click

End Sub

Any and all help is very much appreciated!

Viewing all articles
Browse latest Browse all 13329

Trending Articles