Hi
I have the below code to save a report to pdf. However, I don't want the report to open so could someone suggest what I need to change in the code, please:
I have the below code to save a report to pdf. However, I don't want the report to open so could someone suggest what I need to change in the code, please:
Code:
Private Sub CreateReportBtn_Click()
On Error GoTo cmdPrintMapArea1_Click_Err
DoCmd.OpenReport Me.RepNameBox, acViewReport, , IIf(Me.DepNameBox = "All", "", "dept='" & Me.DepNameBox & "'")
DoCmd.OutputTo acOutputReport, , acFormatPDF
DoCmd.Close acReport, Me.RepNameBox
Exit Sub