⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form12.frm

📁 1) 用户管理功能:用户权限、用户添加、修改及登录 2) 药品名称管理:药品名称的添加、修改和删除 3) 药品价格管理:价格初始
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form Form12 
   Caption         =   "数据备份与恢复"
   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         =   "数据恢复"
      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         =   "数据备份"
      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"     '要备份的文件为当前文件夹下的 db1.mdb
mfile2 = CommonDialog1.FileName        '得到目标文件的路径

If Trim(mfile2) = "" Then Exit Sub
If Dir(mfile2) <> "" Then
If MsgBox(Dir(mfile2) & " 文件已经存在,是否替换?", 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"   '要覆盖掉当前文件夹下的 db1.mdb

If Trim(mfile) = "" Then Exit Sub

If MsgBox("是否恢复数据库?", 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 "恢复完毕!"
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -