Results 1 to 2 of 2
12-17-12, 11:58 #1Registered User
- Join Date
- Jul 2012
Unanswered: Output Report in PDF Format with Customized File Name
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
Any and all help is very much appreciated!
Last edited by doopml; 12-17-12 at 14:05.
12-17-12, 16:55 #2Registered User
Provided Answers: 1
- Join Date
- May 2005
- Nevada, USA
Well, the OpenReport line is what's printing it. You don't need that line based on what you're doing. You can use FollowHyperlink or Shell to open the PDF file after its created.Paul