'取得后台数据库文件路径名 strSource = GetDbSetting("DataFileName", "") If Not strSource Like "[A-z]:\*" Then strSource =CurrentProject.Path & "\" & strSource '取得备份目录路径名 strBackupDir = GetDbSetting("BackupDir", "备份\") If Not strBackupDir Like "[A-z]:*" Then strBackupDir =CurrentProject.Path & "\" & strBackupDir If Not FolderExists(strBackupDir) Then strBackupDir =CreateDir(strBackupDir) '取得备份文件路径名 strDestination = Mid$(strSource, InStrRev(strSource, "\") + 1) strDestination = strBackupDir & Format$(Now(), "yyyy-mm-ddhh.nn_") & strDestination & ".bak" WithApplication.FileSearch .NewSearch .LookIn = strBackupDir .SearchSubFolders = False '如果已有备份文件数量加1大于允许的最大备份数量,则删除多出来的早期文件 lngMaxQty = GetDbSetting("MaxBackFileQuantity", 0) .FileName = "*.bak" If .Execute > 0 And lngMaxQty > 0 Then If .FoundFiles.Count + 1 > lngMaxQty Then For intI = 1 To (.Execute + 1 -lngMaxQty) Kill .FoundFiles(intI) Next End If End If ' access2010运行时提示“你输入的表达式对属性.FileSearch的引用无效”,如何解决?谢谢!
|