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

📄 form2.frm

📁 图书管管理系统 借阅还书续借用户的添加删除修改 用户的权限
💻 FRM
字号:
VERSION 5.00
Begin VB.Form setbooktype 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "书籍类别设置"
   ClientHeight    =   3990
   ClientLeft      =   6150
   ClientTop       =   2970
   ClientWidth     =   4080
   Icon            =   "Form2.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3990
   ScaleWidth      =   4080
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Command6 
      Caption         =   "关闭(&C)"
      Height          =   495
      Left            =   2040
      TabIndex        =   11
      Top             =   3360
      Width           =   1935
   End
   Begin VB.CommandButton Command5 
      Caption         =   "删除(&D)"
      Enabled         =   0   'False
      Height          =   495
      Left            =   120
      TabIndex        =   10
      Top             =   3360
      Width           =   1935
   End
   Begin VB.CommandButton Command4 
      Caption         =   "修改(&E)"
      Enabled         =   0   'False
      Height          =   495
      Left            =   2040
      TabIndex        =   9
      Top             =   2880
      Width           =   1935
   End
   Begin VB.CommandButton Command3 
      Caption         =   "添加(&A)"
      Height          =   495
      Left            =   120
      TabIndex        =   8
      Top             =   2880
      Width           =   1935
   End
   Begin VB.Frame Frame1 
      Caption         =   "图书类别信息"
      Height          =   2535
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   3855
      Begin VB.CommandButton Command2 
         Caption         =   "清除"
         Height          =   375
         Left            =   2760
         TabIndex        =   13
         Top             =   720
         Width           =   855
      End
      Begin VB.CommandButton Command1 
         Caption         =   "查找"
         Height          =   375
         Left            =   2760
         MaskColor       =   &H80000008&
         Style           =   1  'Graphical
         TabIndex        =   7
         Top             =   360
         Width           =   855
      End
      Begin VB.TextBox Text3 
         BackColor       =   &H00C0FFFF&
         Height          =   375
         Left            =   1080
         TabIndex        =   6
         Top             =   1800
         Width           =   1455
      End
      Begin VB.TextBox Text2 
         BackColor       =   &H00C0FFFF&
         Height          =   375
         Left            =   1080
         TabIndex        =   5
         Top             =   1080
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H00C0FFFF&
         Height          =   375
         Left            =   1080
         TabIndex        =   4
         Top             =   360
         Width           =   1455
      End
      Begin VB.Label Label4 
         Caption         =   "输入类别代码进行查询"
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   840
         TabIndex        =   12
         Top             =   840
         Width           =   1815
      End
      Begin VB.Label Label3 
         Caption         =   "可借天数"
         Height          =   255
         Left            =   120
         TabIndex        =   3
         Top             =   1920
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "图书种类"
         Height          =   255
         Left            =   120
         TabIndex        =   2
         Top             =   1200
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "类别代码"
         Height          =   255
         Left            =   120
         TabIndex        =   1
         Top             =   480
         Width           =   855
      End
   End
End
Attribute VB_Name = "setbooktype"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private Sub Command1_Click()
Set g_rs = g_db.OpenRecordset("select * from booktype", dbOpenDynaset)
If Text1.Text = "" Then
  MsgBox "请输入类别代码!", vbInformation + vbOKOnly, "警告"
  Text1.SetFocus
  Set g_rs = Nothing
  Exit Sub
End If

Do While Not g_rs.EOF
   If g_rs!类别代码 = Text1.Text Then
     g_strsql = "select * from booktype where 类别代码='" & Text1.Text & "'"
     Set g_rs = g_db.OpenRecordset(g_strsql)
     Text2.Text = g_rs!书籍类别
     Text3.Text = g_rs!借出天数
     Set g_rs = Nothing
     Command4.Enabled = True
     Command5.Enabled = True
     Exit Sub
     End If
 g_rs.MoveNext
Loop

MsgBox "该类别代码不存在,请重新输入!", vbInformation + vbOKOnly, "警告"
textf
Set g_rs = Nothing
Text1.SetFocus

End Sub

Private Sub Command2_Click()
textf
Text1.SetFocus
End Sub

Private Sub Command3_Click()

Set g_rs = g_db.OpenRecordset("select * from booktype", dbOpenDynaset)

If Text1.Text = "" Then
   MsgBox "请输入类别代码!", vbInformation + vbOKOnly, "警告"
   Set g_rs = Nothing
   Text1.SetFocus
   Exit Sub
End If

If Text2.Text = "" Then
   MsgBox "请输入图书种类!", vbInformation + vbOKOnly, "警告"
   Set g_rs = Nothing
   Text2.SetFocus
   Exit Sub
End If

If Text3.Text = "" Then
   MsgBox "请输入可借天数!", vbInformation + vbOKOnly, "警告"
   Set g_rs = Nothing
   Text3.SetFocus
   Exit Sub
End If

Do While Not g_rs.EOF
   If g_rs!类别代码 = Text1.Text Then
     MsgBox "该类别代码已存在,请重新输入!", vbInformation + vbOKOnly, "警告"
     Set g_rs = Nothing
     Text1.SetFocus
     Exit Sub
   End If
 g_rs.MoveNext
Loop
g_rs.AddNew    '添加记录

g_rs!类别代码 = Text1.Text
g_rs!书籍类别 = Text2.Text
g_rs!借出天数 = CInt(Text3.Text)

g_rs.Update

MsgBox "信息成功保存,请点确定键退出!", vbInformation + vbOKOnly, "信息"

Set g_rs = Nothing '释放
textf

End Sub

Private Sub Command4_Click()
Set g_rs = g_db.OpenRecordset("select * from booktype", dbOpenDynaset)

If Text2.Text = "" Then
   MsgBox "请输入图书种类!", vbInformation + vbOKOnly, "警告"
   Set g_rs = Nothing
   Text2.SetFocus
   Exit Sub
End If

If Text3.Text = "" Then
   MsgBox "请输入可借天数!", vbInformation + vbOKOnly, "警告"
   Set g_rs = Nothing
   Text3.SetFocus
   Exit Sub
End If

g_rs.Edit
  g_rs.Fields("书籍类别").Value = Text2.Text
  g_rs.Fields("借出天数").Value = CInt(Text3.Text)
g_rs.Update

MsgBox "信息成功修改,请点确定键退出!", vbInformation + vbOKOnly, "信息"
Set g_rs = Nothing
textf
Command4.Enabled = False
Command5.Enabled = False
End Sub

Private Sub Command5_Click()
Set g_rs = g_db.OpenRecordset("select * from booktype", dbOpenDynaset)

If MsgBox("你确定要删除类别代码为" & Text1.Text & "的类别信息吗?", _
  vbInformation + vbOKCancel, "删除") = vbCancel Then
   Set g_rs = Nothing
   Exit Sub
Else
   g_strsql = "select * from booktype where 类别代码='" & Text1.Text & "'"
   Set g_rs = g_db.OpenRecordset(g_strsql)
   g_rs.Delete
   textf
   Set g_rs = Nothing
   MsgBox "删除成功,请点确定键返回!", vbInformation + vbOKOnly, "信息"
End If
  
   Command4.Enabled = False
   Command5.Enabled = False
End Sub

Private Sub Command6_Click()
Unload Me
End Sub

Private Sub Form_Load()
dbl
End Sub

Private Sub Text1_Change()
Text1.Text = UCase$(Text1.Text)
End Sub

Public Sub textf()
   Text1.Text = ""
   Text2.Text = ""
   Text3.Text = ""
End Sub

⌨️ 快捷键说明

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