VBA基础
[技巧分享]Access自动生成按日期递增的文件名
2013-07-09 08:45:48
自动生成按日期递增的文件名 Function NextFileName()     Dim fileprefix As String*1     Dim tempNextFileName As String     Dim txtFilePath As String     Dim strYYYYMM as String*6          strYYYYMM = Format(Now(),"yyyymm")     txtFilePath = "c:\exported_data\"     fileprefix = "A"     Do While True         tempNextFileName = txtFilePath & fileprefix & _                        strYYYYMM & ".txt"         If Dir(tempNextFileName) = "" Then             Exit Do         End If         fileprefix = Chr(Asc(fileprefix) + 1)     Loop     NextFileName = tempNextFileName End Function