有没有办法让accesss自动备份

来源:百度知道 编辑:UC知道 时间:2024/05/17 05:12:05
如题,能不能编辑一个小程序定时自动调用Access数据库备份功能已实现自动备份功能或者Access数据库自带有自动备份的功能?

用VB编写自动备份文件程序
--------------------------------------

Public Sub BackupFile(Filename As String, Drive As String, Folder As String)
Dim Fso As New FileSystemObject '创建 FSO 对象实例
Dim Dest_path As String, Counter As Long
Dim StrDay As String, StrMonth As String, NewFilename As String

Counter = 0
Do While Counter < 6 '如果驱动器没准备好,继续检测。共检测 6 秒
Counter = Counter + 1
Call Waitfor(1) '间隔 1 秒
If Fso.Drives(Drive).IsReady = True Then
Exit Do
End If
Loop
If Fso.Drives(Drive).IsReady = False Then '6 秒后目标盘仍未准备就绪,退出
MsgBox " 目标驱动器 " & Drive & " 没有准备好! ", vbCritical
Exit Sub
End If
If Fso.GetDrive(Drive).FreeSpace < Fso.GetFile(Filename).Size Then
MsgBox "目标驱动器空间太小!", vbCritical '目标驱动器空间不够,退出
Exit Sub
End If
If Right(Drive, 1) <> ":" Then
Drive = Drive & ":"
End If