I am trying to email a report and rename the report after the referenced NCR# currently selected on my form. My codes works for putting the referenced NCR# in my email subject, but I am having issues renaming the report and the error is with the SetProperty line bolded below. When I click my email button, I get Run-time error 32004: The contronl name "Supplier Chargebacks" is mispelled or refers to a control that doesen't exists.
Thanks
Private Sub Command587_Click()
Dim stReport As String
Dim stWhere As String
Dim stSubject As String
Dim NCRNum As String
NCRNum = Forms![NCR Input Form]![NCR #]
stSubject = "Supplier Chargebacks NCR " & NCRNum
stReport = "Supplier Chargebacks"
stWhere = "[NCR #] = " & "'" & NCRNum & "'"
DoCmd.OpenReport stReport, acViewPreview, "", stWhere, acWindowNormal, ""
DoCmd.SetProperty stReport, acPropertyCaption, "Supplier Chargebacks NCR " & NCRNum
DoCmd.SendObject acSendReport, stReport, "PDFFormat(*.pdf)", , , , stSubject, , True, ""
DoCmd.Close acReport, stReport
DoCmd.SendObject acSendReport
End Sub