这里发生的是报告每天都在重写。如何使用日期使输出名称唯一?所以每次都不会被删除?
Public Function RunDMR()
'E:\Management Reports
Dim myfile As String
myfile = "E:\Management Reports\B3-Daily Fiscal Report on Net Estimated to Receive by Ins - 45.pdf"
DoCmd.OutputTo acOutputReport, "B3: Daily Fiscal Report on Net Estimated to Receive by Ins - 45", acFormatPDF, myfile, False
End Function
答案 0 :(得分:0)
要在报告名称中添加日期,请使用以下命令:
myfile = "E:\Management Reports\B3-Daily Fiscal Report on Net Estimated to Receive by Ins - 45_" & format(date,"YYYYMMDD") & ".pdf"
添加日期&到报告名称的时间,请使用以下内容:
myfile = "E:\Management Reports\B3-Daily Fiscal Report on Net Estimated to Receive by Ins - 45_" & format(Now(),"YYYYMMDD_HHMMSS") & ".pdf"