access数据库备份

xiaoMONKEY 2005-03-19 05:06:20
如何备份和恢复有密码的 ACCESS 2000
...全文
292 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaoMONKEY 2005-03-21
  • 打赏
  • 举报
回复
问题还没有解决
 下面是我的代码 
我觉得不是 FILECOPY 有问题,而是VB6.0不支持拷ACCESS 2000的问题,各位有何高见?
bakfilename = Trim(Text1.Text)
If Me.Caption = "备份数据库" Then
On Error GoTo ss
If Len(Dir(bakfilename)) > 0 Then
If MsgBox("此文件已存在,是否替换?", 1 + 32, "询问窗口") = 1 Then
Fwait.Show
Fwait.Refresh
Kill bakfilename '删除已存在同名文件
Else
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
End If
FileCopy App.Path + "\CY.mdb", Trim(Text1.Text)
MsgBox "数据库已成功备份!", 0 + 48, "提示"
Unload Fwait
Unload Me
Exit Sub
ss:
MsgBox Err.Description
Unload Fwait
Unload Me
Else
On Error GoTo xx
If MsgBox("恢复前请先作好备份,确定恢复吗?", 1 + 32, "询问提示") = 1 Then
Else
Unload Me
Exit Sub
End If
Fwait.Show
Fwait.Refresh
If Len(Dir(bakfilename)) <= 0 Then
MsgBox "源文件不存在,不能恢复!", 0 + 16, "提示"
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.SetFocus
Unload Fwait
Exit Sub
End If

Kill App.Path + "\CY.mdb"
FileCopy Trim(bakfilename), App.Path + "\CY.mdb"
MsgBox "数据库已成功恢复!", 0 + 48, "提示"
Unload Fwait
Unload Me
Exit Sub
xx:
Unload Fwait
MsgBox Err.Description
Unload Me
End If
xiaoMONKEY 2005-03-21
  • 打赏
  • 举报
回复
怎么还没人回呀,再顶
xiaoMONKEY 2005-03-21
  • 打赏
  • 举报
回复
怎么没人回呀,各位帮帮忙
vbnewplay 2005-03-19
  • 打赏
  • 举报
回复
Dim itmX, key As String '定义字符串变量
Dim a As Integer '定义整型变量
Private Sub Form_Load()
Option1.Value = True
Dir1_Change
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
'添加数据备份卡到列表中
ListView1.ListItems.Clear
If File1.ListCount <> 0 Then
a = 0
Do While File1.ListIndex < File1.ListCount - 1
File1.ListIndex = a
key = File1.FileName
Set itmX = ListView1.ListItems.Add(, , key, 1)
a = a + 1
Loop
End If
Label1.Caption = Dir1.Path & "\" & File1.FileName
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_Click()
Label1.Caption = Dir1.Path & "\" & File1.FileName '获取路径
End Sub
Private Sub Command1_Click()
If Option1.Value = True Then
'备份数据库
If File1.ListCount <> 0 Then
FileCopy Trim(Label1.Caption), Date & "备份卡" & File1.FileName
Me.MousePointer = 0
MsgBox "数据已备份完毕!"
key = Date & "备份卡" & File1.FileName
Set itmX = ListView1.ListItems.Add(, , key, 1)
End If
End If
If Option2.Value = True Then
'恢复指定路径下的数据库
If File1.ListCount <> 0 Then
FileCopy ListView1.SelectedItem, File1.FileName
Me.MousePointer = 0
MsgBox "数据已恢复完毕!"
Else
MsgBox "请选择要恢复的数据!"
End If
End If
End Sub
Private Sub Command2_Click()
End
End Sub

xiaoMONKEY 2005-03-19
  • 打赏
  • 举报
回复
我拷的时候弹出无权限操作的提示,这怎么解决?
yangao 2005-03-19
  • 打赏
  • 举报
回复
如果没有特殊要求
ACCESS备份把数据库直接拷贝到另一个地方即可
还原就是再拷贝回来覆盖掉
这样比较简单

1,216

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧