?? form12.frm
字號:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form Form12
Caption = "數(shù)據(jù)備份與恢復(fù)"
ClientHeight = 4320
ClientLeft = 3945
ClientTop = 2205
ClientWidth = 7470
LinkTopic = "Form12"
Picture = "Form12.frx":0000
ScaleHeight = 4320
ScaleWidth = 7470
Begin VB.CommandButton Command3
Caption = "退出"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5040
TabIndex = 2
Top = 3000
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "數(shù)據(jù)恢復(fù)"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5040
TabIndex = 1
Top = 960
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "數(shù)據(jù)備份"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
TabIndex = 0
Top = 960
Width = 1215
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 1080
Top = 3120
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
End
Attribute VB_Name = "Form12"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim mfile As String, mfile2 As String
On Error Resume Next
CommonDialog1.Filter = "*.mdb"
CommonDialog1.ShowSave
mfile = App.Path & "\藥品管理.mdb" '要備份的文件為當(dāng)前文件夾下的 db1.mdb
mfile2 = CommonDialog1.FileName '得到目標(biāo)文件的路徑
If Trim(mfile2) = "" Then Exit Sub
If Dir(mfile2) <> "" Then
If MsgBox(Dir(mfile2) & " 文件已經(jīng)存在,是否替換?", vbYesNo, "警告") = vbNo Then Exit Sub
End If
Dim buff() As Byte, i As Long
i = FileLen(mfile)
ReDim buff(i - 1)
Open mfile For Binary As #1
Get #1, , buff
Close #1
Open mfile2 For Binary As #1
Put #1, , buff
Close #1
MsgBox "備份完畢!", vbInformation
End Sub
Private Sub Command2_Click()
Dim mfile As String, mfile2 As String
On Error Resume Next
CommonDialog1.Filter = App.Path & "藥品管理.mdb"
CommonDialog1.ShowOpen
mfile = CommonDialog1.FileName '得到別處的Access文件的路徑
mfile2 = App.Path & "\藥品管理.mdb" '要覆蓋掉當(dāng)前文件夾下的 db1.mdb
If Trim(mfile) = "" Then Exit Sub
If MsgBox("是否恢復(fù)數(shù)據(jù)庫?", vbYesNo, "警告") = vbNo Then Exit Sub
Dim buff() As Byte, i As Long
i = FileLen(mfile)
ReDim buff(i - 1)
Open mfile For Binary As #1
Get #1, , buff
Close #1
Open mfile2 For Binary As #1
Put #1, , buff
Close #1
MsgBox "恢復(fù)完畢!"
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -