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!