I've got the code below to save a report as a PDF at the click of a button. The button works fine, but whenever it is clicked, the report is also printed out. Does anyone know why this would be and is there a way to stop it from printing?
Code:
Private Sub Command271_Click()
Dim ReportName As String
Dim URNCriteria As String
Dim FileName As String
Dim FilePath As String
ReportName = "AgreementAVDF"
URNCriteria = "Table1.[URN] = Forms![frm1]![URN]"
FileName = "AgreementAVDF" & " - " & Me.[Company Name]
FilePath = "\\scc01\Data\Backup\Folder 1\Folder 2\Folder 3\Agreements\" & FileName & ".pdf"
DoCmd.OpenReport ReportName, acViewNormal, URNCriteria
DoCmd.OutputTo acOutputReport, "AgreementAVDF", acFormatPDF, FilePath
DoCmd.Close acReport, "AgreementAVDF"
End Sub