📄 frmdatarestore.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmDataRestore
BorderStyle = 3 'Fixed Dialog
Caption = "数据库恢复"
ClientHeight = 4350
ClientLeft = 45
ClientTop = 330
ClientWidth = 6195
Icon = "frmDataRestore.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4350
ScaleWidth = 6195
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin MSComctlLib.ImageList ImageList2
Left = 5040
Top = 3945
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 2
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmDataRestore.frx":030A
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmDataRestore.frx":0B5E
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 4635
Top = 3945
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 2
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmDataRestore.frx":1092
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmDataRestore.frx":13AE
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 810
Left = 0
TabIndex = 6
Top = 0
Width = 6195
_ExtentX = 10927
_ExtentY = 1429
ButtonWidth = 1032
ButtonHeight = 1376
Appearance = 1
Style = 1
ImageList = "ImageList2"
HotImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 3
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "恢复"
Key = "Restore"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "Close"
ImageIndex = 2
EndProperty
EndProperty
Begin VB.OptionButton Option3
Caption = "删除再导入"
Height = 180
Left = 4755
TabIndex = 10
Top = 360
Visible = 0 'False
Width = 1275
End
Begin VB.OptionButton Option2
Caption = "忽略已存在数据"
Height = 195
Left = 3075
TabIndex = 9
Top = 345
Visible = 0 'False
Width = 1635
End
Begin VB.OptionButton Option1
Caption = "覆盖已有数据"
Height = 285
Left = 1530
TabIndex = 8
Top = 285
Visible = 0 'False
Width = 1485
End
End
Begin VB.Timer Timer1
Interval = 1000
Left = 5550
Top = 10275
End
Begin VB.CommandButton cmdClose
Caption = "退出"
Height = 390
Left = 5325
TabIndex = 5
Top = 4065
Visible = 0 'False
Width = 840
End
Begin VB.CommandButton cmdRestore
Caption = "恢复"
Height = 390
Left = 5400
TabIndex = 4
Top = 4005
Visible = 0 'False
Width = 840
End
Begin VB.FileListBox File1
BackColor = &H00FFFFFF&
ForeColor = &H00000000&
Height = 1530
Left = 255
TabIndex = 3
Top = 1410
Width = 2745
End
Begin VB.DriveListBox Drive1
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 330
Left = 3150
TabIndex = 2
Top = 3840
Width = 2715
End
Begin VB.DirListBox Dir1
BackColor = &H00FFFFFF&
ForeColor = &H00000000&
Height = 2820
Left = 3150
TabIndex = 1
Top = 1035
Width = 2715
End
Begin VB.TextBox txtFileName
BackColor = &H00FFFFFF&
ForeColor = &H00000000&
Height = 300
Left = 270
TabIndex = 0
Top = 1050
Width = 2730
End
Begin VB.Label Label1
BackColor = &H00CCB400&
BorderStyle = 1 'Fixed Single
Caption = " 数据恢复为防止数据因掉电和无意损坏而造成的损失,可采用此功能。"
ForeColor = &H00000000&
Height = 1095
Left = 255
TabIndex = 7
Top = 3075
Width = 2730
End
Begin VB.Shape Shape2
BorderColor = &H80000005&
Height = 3330
Left = 75
Top = 975
Width = 6045
End
Begin VB.Shape Shape1
BorderColor = &H00808080&
Height = 3330
Left = 60
Top = 960
Width = 6045
End
Begin VB.Line Line3
BorderColor = &H80000005&
X1 = 0
X2 = 6195
Y1 = 855
Y2 = 855
End
Begin VB.Line Line2
X1 = 0
X2 = 6195
Y1 = 0
Y2 = 0
End
Begin VB.Line Line1
BorderColor = &H80000003&
X1 = 0
X2 = 6195
Y1 = 840
Y2 = 840
End
End
Attribute VB_Name = "frmDataRestore"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Fso As New FileSystemObject
Dim Fil As File
Dim TimeDelay As Integer
Dim BaseName As String
Dim Start As Boolean, CopyStat As Boolean
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdRestore_Click()
Dim FileExist As Boolean
If txtFileName.Text = "" Then
MsgBox "请选择恢复数据库!"
Exit Sub
End If
Screen.MousePointer = 11
If Right$(Dir1.Path, 1) = "\" Then
BaseName = Dir1.Path + File1.Filename
Else
BaseName = Dir1.Path + "\" + File1.Filename
End If
FileExist = Fso.FileExists(BaseName)
If FileExist = False Then
Screen.MousePointer = 0
MsgBox "指定的文件不存在,请重新选择数据库文件!"
Exit Sub
Else
Start = True
TimeDelay = 0
frmWait.Show 1
If CopyStat Then
Screen.MousePointer = 0
MsgBox "数据恢复成功!", vbInformation
CopyStat = False
Else
End If
Timer1.Enabled = True
End If
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
File1.Pattern = "*.mdb"
End Sub
Private Sub Drive1_Change()
On Error GoTo eh
Dir1.Path = Drive1.Drive
Exit Sub
eh:
Select Case Err.Number
Case 68
MsgBox "请把软盘插到软驱!", vbCritical
Drive1.Drive = "C:"
Dir1.Path = App.Path & "\Data"
Exit Sub
End Select
End Sub
Private Sub File1_Click()
txtFileName.Text = File1.Filename
End Sub
Private Sub Form_Load()
On Error Resume Next
MdbR.Close
NdMd.Close
Drive1.Drive = "C:"
Dir1.Path = App.Path & "\Data"
TimeDelay = 0
Start = False
End Sub
Private Sub Timer1_Timer()
On Error GoTo ErrRepo
TimeDelay = TimeDelay + 1
If TimeDelay >= 3 And Start = True Then
Timer1.Enabled = False
Set Fil = Fso.GetFile(BaseName)
Fil.Copy App.Path & "\Data\Eletricity.Mdb", True
Unload frmWait
Start = False
CopyStat = True
Exit Sub
End If
Exit Sub
ErrRepo:
If Err.Number = 70 Then
MsgBox "数据恢复失败!" & Chr(13) & Err.Description & Chr(13) & "请检查系统数据是否已打开!", vbInformation
Unload frmWait
Start = False
'CopyStat = True
Exit Sub
Else
MsgBox Err.Description, vbInformation
Exit Sub
End If
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "Restore"
cmdRestore_Click
Case "Close"
cmdClose_Click
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -