首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

用VB解决Access数据库备份有关问题

2012-02-15 
用VB解决Access数据库备份问题怎么用代码实现VB解决Access数据库的备份啊用driver和dir控件再加一个button

用VB解决Access数据库备份问题
怎么用代码实现VB解决Access数据库的备份啊
      用driver   和dir   控件   再加一个button按钮实现整个数据库的备份
        备份目录在driver和dir所指定的目录下面
   


[解决办法]
Private Sub Command1_Click() '确认数据备份
Dim s As String
s = MsgBox( "准备好了吗? ", vbYesNo + vbQuestion, "提示 ")
If s = vbNo Then
Exit Sub
End If
On Error GoTo errprompt
Me.MousePointer = 11
If Dir(Text1.Text & ":\数据备份 ", vbDirectory) = " " Then
MkDir Text1.Text & ":\数据备份 "
Set bf = CreateObject( "Scripting.FileSystemObject ")
bf.CopyFile App.Path & "\system.dll ", Text1.Text & ":\数据备份\system " & Date & ".dll "
Me.MousePointer = 0
s = MsgBox( "数据已备份完毕! ", vbInformation, "提示 ")
errprompt:
Me.MousePointer = 0
Select Case Err.Number
Case 57
s = MsgBox( "磁盘已满! ", vbCritical, "提示 ")
Case 70
s = MsgBox( "磁盘写保护!请回到原文件进行复制system.dll ", vbCritical, "提示 ")
End Select
Else
On Error GoTo errprompt1
Set bf = CreateObject( "Scripting.FileSystemObject ")
bf.CopyFile App.Path & "\system.dll ", Text1.Text & ":\数据备份\system " & Date & ".dll "
Me.MousePointer = 0
s = MsgBox( "数据已备份完毕! ", vbInformation, "提示 ")
errprompt1:
Me.MousePointer = 0
Select Case Err.Number
Case 57
s = MsgBox( "磁盘已满! ", vbCritical, "提示 ")
Case 70
s = MsgBox( "磁盘写保护!请回到原文件进行复制system.dll ", vbCritical, "提示 ")
End Select
End If
End Sub

热点排行