Saving Report as PDF - Save As Prompt
Posted on 2002-07-11
I'm using the following code to save a report as a PDF file. Everything works but the Save As box pops up requesting a file name and another box after that asking whether or not I want to replace the existing file. I want it to automatically save the file and replace the existing file. How can I do this?
Dim db As Database
Dim rs As Recordset
Dim rpt As Report
Dim strReportName As String
strReportName = "Report1"
Set db = CurrentDb
Set rs = db.OpenRecordset("DevStructure")
DoCmd.OpenReport strReportName, acViewDesign
Set rpt = Application.Reports(strReportName)
rpt.PrtDevMode = rs.Fields(0)
rpt.PrtDevNames = rs.Fields(1)
DoCmd.OpenReport strReportName, acViewNormal
DoCmd.Close acReport, strReportName, acSaveNo