📄 frm_bfhf.frm
字号:
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 0
Left = 510
TabIndex = 4
Top = 165
Width = 3210
End
End
Begin VB.CommandButton Command1
BackColor = &H00C0E0FF&
Cancel = -1 'True
Caption = "取消"
Height = 360
Index = 2
Left = 4695
Style = 1 'Graphical
TabIndex = 3
Top = 4095
Width = 1290
End
Begin VB.Line Line1
BorderColor = &H00FFFFFF&
Index = 1
X1 = -15
X2 = 6045
Y1 = 3960
Y2 = 3960
End
Begin VB.Line Line1
BorderColor = &H00808080&
Index = 0
X1 = 0
X2 = 6060
Y1 = 3945
Y2 = 3945
End
Begin VB.Image Image1
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Height = 3945
Index = 0
Left = 1680
Picture = "frm_bfhf.frx":000C
Stretch = -1 'True
Top = 4875
Width = 1860
End
Begin VB.Image Image1
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Height = 3945
Index = 2
Left = -195
Picture = "frm_bfhf.frx":242CA
Stretch = -1 'True
Top = 5025
Width = 1860
End
Begin VB.Image Image1
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Height = 3945
Index = 1
Left = 0
Picture = "frm_bfhf.frx":48DBC
Stretch = -1 'True
Top = 0
Width = 1860
End
End
Attribute VB_Name = "frm_bfhf"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim step As Integer
Dim borh As Boolean
'Private Declare Function WriteProfileString Lib "kernel32" Alias "WriteProfileStringA" (ByVal lpszSection As String, ByVal lpszKeyName As String, ByVal lpszString As String) As Long
'Private Declare Function GetProfileString Lib "kernel32" Alias "GetProfileStringA" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As Long
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0
step = step - 1
disa step
Case 1
step = step + 1
borh = Option1(0).Value
disa step
Case 2
Unload Me
End Select
End Sub
Private Sub Dir1_Change()
Label2(2).Caption = "当前路径: " + Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo myerr
Dir1.Path = Drive1.Drive
Exit Sub
myerr:
yn = MsgBox(Err.Description, vbRetryCancel + vbCritical, "错误")
If yn = vbRetry Then
Resume
Else
Drive1.Drive = Dir1.Path
End If
End Sub
Private Sub Form_Load()
'frm_main.Toolbar2.Buttons(3).Enabled = False
Me.Height = 4950
step = 1
disa step
End Sub
Private Sub OKButton_Click()
End Sub
Private Sub disa(s As Integer)
Select Case s
Case 1
For i = 0 To Image1.Count - 1
Image1(i).Visible = False
Next i
Image1(s - 1).Visible = True
Image1(s - 1).Move 0, 0
For i = 0 To Picture1.Count - 1
Picture1(i).Visible = False
Next i
Picture1(s - 1).Visible = True
Picture1(s - 1).Move 1845, 0
Command1(0).Enabled = False
Command1(1).Enabled = True
Command1(2).Enabled = True
Command1(1).Caption = "下一步(&N)"
Me.Caption = "备份/恢复向导(共 3 步)"
Case 2
For i = 0 To Image1.Count - 1
Image1(i).Visible = False
Next i
Image1(s - 1).Visible = True
Image1(s - 1).Move 0, 0
For i = 0 To Picture1.Count - 1
Picture1(i).Visible = False
Next i
Picture1(s - 1).Visible = True
Picture1(s - 1).Move 1845, 0
Command1(0).Enabled = True
Command1(1).Enabled = True
Command1(2).Enabled = True
Command1(1).Caption = "下一步(&N)"
Me.Caption = "第一步:选择备份或恢复(共 3 步)"
Case 3
For i = 0 To Image1.Count - 1
Image1(i).Visible = False
Next i
Image1(s - 1).Visible = True
Image1(s - 1).Move 0, 0
For i = 0 To Picture1.Count - 1
Picture1(i).Visible = False
Next i
Picture1(s - 1).Visible = True
Picture1(s - 1).Move 1845, 0
Command1(0).Enabled = True
Command1(1).Enabled = True
Command1(2).Enabled = True
Command1(1).Caption = "完成(&C)"
If borh Then
Me.Caption = "第二步:选择备份路径(共 3 步)"
Label1(13).Caption = "第二步:选择备份路径"
Else
Me.Caption = "第二步:选择恢复路径(共 3 步)"
Label1(13).Caption = "第二步:选择恢复路径"
End If
Label2(2).Caption = "当前路径: " + Dir1.Path
Case 4
On Error GoTo myerr
Me.Caption = "第三步:完成情况(共 3 步)"
For i = 0 To Picture1.Count - 1
Picture1(i).Visible = False
Next i
Picture1(s - 1).Visible = True
Picture1(s - 1).Move 1845, 0
If borh Then '备份
sqlstr = "update save set save.value='" + byk_maxno + "' where save.name='byk_maxno'"
db.Execute sqlstr
sqlstr = "update save set save.value='" + lck_maxno + "' where save.name='lck_maxno'"
db.Execute sqlstr
sqlstr = "update save set save.value='" + mfbyk_maxno + "' where save.name='mfbyk_maxno'"
db.Execute sqlstr
sqlstr = "update save set save.value='" + dcxj_maxno + "' where save.name='dcxj_maxno'"
db.Execute sqlstr
sqlstr = "update save set save.value='" + dcsj_maxno + "' where save.name='dcsj_maxno'"
db.Execute sqlstr
sqlstr = "update save set save.value='" + hzpxj_maxno + "' where save.name='hzpxj_maxno'"
db.Execute sqlstr
sqlstr = "update save set save.value='" + hzpsj_maxno + "' where save.name='hzpsj_maxno'"
db.Execute sqlstr
sqlstr = "update save set save.value='" + lygxj_maxno + "' where save.name='lygxj_maxno'"
db.Execute sqlstr
sqlstr = "update save set save.value='" + mfxj_maxno + "' where save.name='mfxj_maxno'"
db.Execute sqlstr
sqlstr = "update save set save.value='" + mfsj_maxno + "' where save.name='mfsj_maxno'"
db.Execute sqlstr
db.Close
Label1(6).Caption = "请稍等,正在备份数据 ..."
Me.MousePointer = 11
ProgressBar1.Value = 37
If Right(Dir1.Path, 1) = "\" Then
FileCopy AppPath + "datas\mry.mdb", Dir1.Path + "mry.mdb"
Else
FileCopy AppPath + "datas\mry.mdb", Dir1.Path + "\mry.mdb"
End If
'WriteProfileString "Options", "byk_maxno", byk_maxno
Set db = OpenDatabase(AppPath + "datas\mry.mdb", True, False, ";PWD=miracle")
Label1(6).Caption = "数据备份完毕。"
ProgressBar1.Value = 100
Command1(2).Caption = "退出(&E)"
Command1(0).Enabled = False
Command1(1).Enabled = False
ProgressBar1.Visible = False
Me.MousePointer = 0
Else '恢复
Label1(6).Caption = "请稍等,正在恢复数据 ..."
Me.MousePointer = 11
ProgressBar1.Value = 37
If Right(Dir1.Path, 1) = "\" Then
If Dir(Dir1.Path + "mry.mdb") = "" Then
MsgBox "该路径下没有可以用来恢复的文件", vbOKOnly + vbCritical, "错误"
step = 3
disa step
Me.MousePointer = 0
Exit Sub
End If
db.Close
FileCopy Dir1.Path + "mry.mdb", AppPath + "datas\mry.mdb"
Else
If Dir(Dir1.Path + "\mry.mdb") = "" Then
MsgBox "该路径下没有可以用来恢复的文件", vbOKOnly + vbCritical, "错误"
step = 3
disa step
Me.MousePointer = 0
Exit Sub
End If
db.Close
FileCopy Dir1.Path + "\mry.mdb", AppPath + "datas\mry.mdb"
End If
Set db = OpenDatabase(AppPath + "datas\mry.mdb", True, False, ";PWD=miracle")
Dim rec As Recordset
Set rec = db.OpenRecordset("save")
Do While Not rec.EOF
Select Case rec.Fields("name")
Case "byk_maxno"
byk_maxno = rec.Fields("value")
Case "lck_maxno"
lck_maxno = rec.Fields("value")
Case "mfbyk_maxno"
mfbyk_maxno = rec.Fields("value")
Case "dcxj_maxno"
dcxj_maxno = rec.Fields("value")
Case "dcsj_maxno"
dcsj_maxno = rec.Fields("value")
Case "hzpxj_maxno"
hzpxj_maxno = rec.Fields("value")
Case "hzpsj_maxno"
hzpsj_maxno = rec.Fields("value")
Case "lygxj_maxno"
lygxj_maxno = rec.Fields("value")
Case "mfxj_maxno"
mfxj_maxno = rec.Fields("value")
Case "mfsj_maxno"
mfsj_maxno = rec.Fields("value")
End Select
rec.MoveNext
Loop
rec.Close
Set rec = Nothing
SaveSetting App.title, "Options", "byk_maxno", byk_maxno
SaveSetting App.title, "Options", "lck_maxno", lck_maxno
SaveSetting App.title, "Options", "mfbyk_maxno", mfbyk_maxno
SaveSetting App.title, "Options", "mfxj_maxno", mfxj_maxno
SaveSetting App.title, "Options", "mfsj_maxno", mfsj_maxno
SaveSetting App.title, "Options", "lygxj_maxno", lygxj_maxno
SaveSetting App.title, "Options", "hzpxj_maxno", hzpxj_maxno
SaveSetting App.title, "Options", "hzpsj_maxno", hzpsj_maxno
SaveSetting App.title, "Options", "dcxj_maxno", dcxj_maxno
SaveSetting App.title, "Options", "dcsj_maxno", dcsj_maxno
Label1(6).Caption = "数据恢复完毕。"
ProgressBar1.Value = 100
Command1(2).Caption = "退出(&E)"
Command1(0).Enabled = False
Command1(1).Enabled = False
ProgressBar1.Visible = False
Me.MousePointer = 0
End If
Exit Sub
myerr:
If Err.Number = 70 Then
MsgBox "请把所有打开的窗口都关闭后再试一次", vbOKOnly + vbCritical, "错误"
Else
MsgBox Err.Description, vbOKOnly + vbCritical, "错误"
End If
step = 3
disa step
Me.MousePointer = 0
End Select
End Sub
Private Sub Form_Unload(Cancel As Integer)
'frm_main.Toolbar2.Buttons(3).Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -