I would like to automatically save a report to a file. I would like the file name to include the name of a value on the report. I use the OutputTo command to export the report to an .rtf file. This code is executed on the "OnPage" Event. I set the Below is the code that I use, which gives the "Object Required" error on the following line of code:
Set strReportName = Reports!PM_Proj_Num!Text95
The report field referenced exists in the report being run.
Any ideas would be greatly appreciated.
Private Sub Report_Page()
Dim strReportName As String
'Establish the report file name
Set strReportName = Reports!PM_Proj_Num!Text95
'Save the report to a file
DoCmd.OutputTo acReport, "PM_Proj_Num", "RichTextFormat(*.rtf)", "", False, """" & strstrReportName & """"
'Close the report to contine processing the remaining Program Managers' reports
DoCmd.Close acReport, "PM_Proj_Num"
End Sub
Set strReportName = Reports!PM_Proj_Num!Text95
The report field referenced exists in the report being run.
Any ideas would be greatly appreciated.
Private Sub Report_Page()
Dim strReportName As String
'Establish the report file name
Set strReportName = Reports!PM_Proj_Num!Text95
'Save the report to a file
DoCmd.OutputTo acReport, "PM_Proj_Num", "RichTextFormat(*.rtf)", "", False, """" & strstrReportName & """"
'Close the report to contine processing the remaining Program Managers' reports
DoCmd.Close acReport, "PM_Proj_Num"
End Sub