?? frmdatarestore.frm
字號:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmDataRestore
Caption = "數據恢復"
ClientHeight = 3285
ClientLeft = 60
ClientTop = 345
ClientWidth = 5850
Icon = "frmDataRestore.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3285
ScaleWidth = 5850
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消(&C)"
Height = 375
Left = 3461
TabIndex = 7
Top = 2640
Width = 975
End
Begin VB.CommandButton cmdOK
Caption = "確定(&E)"
Default = -1 'True
Height = 375
Left = 1414
TabIndex = 6
Top = 2640
Width = 975
End
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 375
Left = 818
TabIndex = 5
Top = 1920
Visible = 0 'False
Width = 4215
_ExtentX = 7435
_ExtentY = 661
_Version = 393216
Appearance = 1
End
Begin VB.Frame Frame1
Height = 1335
Left = 758
TabIndex = 0
Top = 240
Width = 4335
Begin VB.CheckBox chkRestoreData
Caption = "恢復數據庫"
Height = 255
Left = 2520
TabIndex = 4
Top = 840
Value = 1 'Checked
Width = 1215
End
Begin VB.CheckBox chkRestoreSystem
Caption = "恢復系統庫"
Height = 255
Left = 2520
TabIndex = 3
Top = 360
Value = 1 'Checked
Width = 1215
End
Begin VB.OptionButton optRestoreHard
Caption = "從硬盤恢復"
Height = 255
Left = 600
TabIndex = 2
Top = 840
Width = 1215
End
Begin VB.OptionButton optRestoreFloppy
Caption = "從軟盤恢復"
Height = 255
Left = 600
TabIndex = 1
Top = 360
Value = -1 'True
Width = 1215
End
End
End
Attribute VB_Name = "frmDataRestore"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim fso As New FileSystemObject
Dim drv As Drive
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim strAppName As String, strOldName As String, i As Integer
If optRestoreFloppy.Value = True Then '從軟盤恢復
Set drv = fso.GetDrive("A:")
If Not drv.IsReady Then
MsgBox "驅動器沒有準備好!", vbCritical + vbOKOnly, "數據恢復"
Exit Sub
End If
If Not fso.FolderExists("A:\Backup") Then
MsgBox "備份文件夾不存在!", vbCritical + vbOKOnly, "數據恢復"
Exit Sub
End If
If chkRestoreSystem.Value = Checked Then '恢復系統庫
strAppName = App.Path & "\權限表.mdb"
strOldName = "A:\Backup\權限表.mdb"
RestoreFileAll strOldName, strAppName
strAppName = App.Path & "\用戶檔案.mdb"
strOldName = "A:\Backup\用戶檔案.mdb"
RestoreFileAll strOldName, strAppName
strAppName = App.Path & "\水費標準庫.mdb"
strOldName = "A:\Backup\水費標準庫.mdb"
RestoreFileAll strOldName, strAppName
End If
If chkRestoreData.Value = Checked Then '恢復數據庫
strAppName = App.Path & "\Main" & Year(Now) & Month(Now) & ".mdb"
strOldName = "A:\Backup\Main" & Year(Now) & Month(Now) & ".mdb"
RestoreFileAll strOldName, strAppName
End If
'設置進度條
ProgressBar1.Visible = True
ProgressBar1.Min = 1: ProgressBar1.Max = 100
For i = 1 To 100
ProgressBar1.Value = i
Next
ProgressBar1.Visible = False
ElseIf optRestoreHard.Value = True Then '從硬盤恢復
If Not fso.FolderExists(App.Path & "\Backup") Then
MsgBox "備份文件夾不存在!", vbCritical + vbOKOnly, "數據恢復"
Exit Sub
End If
If chkRestoreSystem.Value = Checked Then '恢復系統庫
strAppName = App.Path & "\權限表.mdb"
strOldName = App.Path & "\Backup\權限表.mdb"
RestoreFileAll strOldName, strAppName
strAppName = App.Path & "\用戶檔案.mdb"
strOldName = App.Path & "\Backup\用戶檔案.mdb"
RestoreFileAll strOldName, strAppName
strAppName = App.Path & "\水費標準庫.mdb"
strOldName = App.Path & "\Backup\水費標準庫.mdb"
RestoreFileAll strOldName, strAppName
End If
If chkRestoreData.Value = Checked Then '恢復數據庫
strAppName = App.Path & "\Main" & Year(Now) & Month(Now) & ".mdb"
strOldName = App.Path & "\Backup\Main" & Year(Now) & Month(Now) & ".mdb"
RestoreFileAll strOldName, strAppName
End If
'設置進度條
ProgressBar1.Visible = True
ProgressBar1.Min = 1: ProgressBar1.Max = 100
For i = 1 To 100
ProgressBar1.Value = i
Next
ProgressBar1.Visible = False
End If
MsgBox "恢復完畢!", vbInformation + vbOKOnly, "數據恢復"
Unload Me
End Sub
Private Sub RestoreFileAll(strOldName As String, strAppName As String)
If Not fso.FileExists(strOldName) Then
MsgBox strOldName & "不存在!", vbCritical + vbOKOnly, "數據恢復"
Exit Sub
End If
fso.CopyFile strOldName, strAppName
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -