请帮我看看这段代码,谢谢
我是一个新手,刚看vb没几天,从网上看到一个备份access数据的实例,但是照写下来编译却通不过,请大家帮我看看,不要笑我菜,谢谢
Option Explicit
Dim dbasize As Long
Dim dbasize2 As Long
Dim PathName As String
Dim NoDba As Boolean
Private mclsMidTier As clsMidTier
Dim DB As Connection
Private Sub cmdClose_Click()
frmDatabaseRestore.Hide
Unload frmDatabaseRestore
End Sub
Private Sub cmdRestore_Click()
If MsgBox( "恢复数据库从 " & txtSource & " 将替换已经存在的文件。你想继续吗? ", vbYesNo) = vbYes Then
DoRestore txtSource.Text, App.Path
' If NoDba = True Then
MsgBox "恢复数据库成功,单击[确定]然后退出程序! "
frmDatabaseRestore.Hide
Unload frmDatabaseRestore
' End If
Else
lblStatus.Caption = "恢复数据库被中止! "
End If
End Sub
Private Sub cmdSource_Click()
On Error GoTo Erro
Dim strTemp As String
strTemp = fBrowseForFolder(Me.hWnd, "Restore From ")
If strTemp <> " " Then
txtSource = strTemp
dbasize2 = FileLen(txtSource & "\Student.MDB ")
lblSelectedDba = "请选择所备份的数据库文件 : " & Format((dbasize2 / 1024) / 1024, "standard ") & "MB. "
cmdRestore.Enabled = True
End If
Erro:
Select Case err.Number
Case 53 'File Not Found
lblSelectedDba = "没有选择备份文件位置! "
cmdRestore.Enabled = False
End Select
End Sub
Private Sub Form_Activate()
lblSize = Format((dbasize / 1024) / 1024, "standard ") & "MB. "
En