2017-03-09 91 views
0

这里发生的是报告每天都在覆盖。我怎样才能使输出名称与日期唯一?所以每次都不会被删除?访问不需要覆盖报告

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

到日期添加到报告名称,使用以下命令:

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"