当前位置:数据库 > Access >>

关闭整个ACCESS能触发什么事件啊? 我想在关闭ACCESS时,自动备份数据库

关闭整个ACCESS能触发什么事件啊? 我想在关闭ACCESS时,自动备份数据库
答案:1没有自动备份的功能。
你需要在服务器上创建一个计划任务来运行一个程序,用程序去备份.



2用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 
If Left(Folder, 1) <> "\" Then 
Folder = "\" & Folder 
End If 
If Right(Folder, 1) <> "\" Then 
Folder = Folder & "\" 
End If 
If Day(Date) < 10 Then 
StrDay = "0" & Day(Date) 
Else 
StrDay = Day(Date) 
End If 
If Month(Date) < 10 Then 
StrMonth = "0" & Month(Date) 
Else 
StrMonth = Month(Date) 
End If 
'Fso.FileExists () 
NewFilename = "newfilename" 
Dest_path = Drive & Folder 
If Not Fso.FolderExists(Dest_path) Then '如果目标文件夹不存在,创建之 
Fso.CreateFolder Dest_path 
End If 
Fso.CopyFile Filename, Dest_path & NewFilename, True 
'拷贝,直接覆盖同名文件 
Set Fso = Nothing 
End Sub 
Private Sub Waitfor(Delay As Single) '延时过程,Delay 单位约为 1 秒 
Dim StartTime As Single 
StartTime = Timer 
Do Until (Timer - StartTime) > Delay 
Loop 
End Sub 


Private Sub Form_Load() 
BackupFile "filename", "d:", "filebackupdir" 
End 
End Sub
其他:不可以的,一定要触发过跟你的结婚对象所有的爱情事件才可以结婚。不过你红心了,可以所有时间一起触发,错过了没关系

上一个:Delphi中用BDE连接ms access数据库总是出错?
下一个:串口接收到的数据如何用C++builder保存到ACCESS数据库中

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,