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

📄 frmborbook.frm

📁 这是一个比较实用的图书馆管理系统的源代码。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmBorbook 
   Caption         =   "借书处理"
   ClientHeight    =   4155
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5205
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4155
   ScaleWidth      =   5205
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton retCom 
      Caption         =   "返回"
      Height          =   375
      Left            =   4320
      TabIndex        =   13
      Top             =   3240
      Width           =   735
   End
   Begin VB.Frame Frame3 
      Caption         =   "输入所借图书的图书编号"
      Height          =   1215
      Left            =   360
      TabIndex        =   10
      Top             =   2520
      Width           =   3855
      Begin VB.CommandButton Comm2 
         Caption         =   "确定"
         Height          =   375
         Left            =   2040
         TabIndex        =   12
         Top             =   480
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Index           =   1
         Left            =   120
         TabIndex        =   11
         Top             =   480
         Width           =   1695
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "读者借书情况"
      Height          =   1215
      Left            =   360
      TabIndex        =   3
      Top             =   1200
      Width           =   3855
      Begin VB.TextBox Text2 
         Height          =   285
         Index           =   2
         Left            =   2880
         TabIndex        =   9
         Top             =   720
         Width           =   855
      End
      Begin VB.TextBox Text2 
         Height          =   285
         Index           =   1
         Left            =   960
         TabIndex        =   8
         Top             =   720
         Width           =   975
      End
      Begin VB.TextBox Text2 
         Height          =   285
         Index           =   0
         Left            =   720
         TabIndex        =   7
         Top             =   240
         Width           =   1335
      End
      Begin VB.Label Label1 
         Caption         =   "可借书数"
         Height          =   375
         Index           =   2
         Left            =   2040
         TabIndex        =   6
         Top             =   720
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "借书总数"
         Height          =   375
         Index           =   1
         Left            =   240
         TabIndex        =   5
         Top             =   720
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "姓名"
         Height          =   375
         Index           =   0
         Left            =   240
         TabIndex        =   4
         Top             =   240
         Width           =   855
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "输入借书证号"
      Height          =   975
      Left            =   360
      TabIndex        =   0
      Top             =   120
      Width           =   3855
      Begin VB.CommandButton Comm1 
         Caption         =   "确定"
         Height          =   375
         Left            =   2400
         TabIndex        =   2
         Top             =   360
         Width           =   975
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Index           =   0
         Left            =   360
         TabIndex        =   1
         Top             =   360
         Width           =   1695
      End
   End
End
Attribute VB_Name = "frmBorbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public sqltxt As String
Public rno As String   '保存读者借书证号
Public bno As String   '保存读者图书编号
Public xm As String   '保存读者姓名
Public dw As String    '保存读者单位
Public rs As ADODB.Recordset

Private Sub Comm1_Click()   '输入借书证号确定
  rno = Trim(Text1(0).Text)
  If rno = "" Then
     MsgBox "借书证号不能为空,请输入", vbOKOnly, "信息提示"
     Comm2.Enabled = False
  Else
     sqltxt = "select * from reader where 借书证号='" + rno + "'"
     Set rs = exesql(sqltxt)
     If rs.RecordCount = 0 Then
        MsgBox "该读者未登记,不能借书", vbOKOnly, "信息提示"
        Comm2.Enabled = False
     Else
        Text2(0).Text = rs.Fields("姓名")
        Text2(1).Text = Str(rs.Fields("借书总数"))
        Text2(2).Text = Str(rs.Fields("借书总数") - rs.Fields("已借书数"))
        If Val(Trim(Text2(2).Text)) > 0 Then
           xm = rs.Fields("姓名")
           dw = rs.Fields("单位")
           Comm2.Enabled = True
        Else
           MsgBox "读者已借满图书,不能再借!", vbOKOnly, "信息提示"
           Comm2.Enabled = False
        End If
      End If
  End If
End Sub

Private Sub Comm2_Click()  '输入图书编号确定
  Dim bs As ADODB.Recordset
  Dim brs As ADODB.Recordset
  If Val(Trim(Text2(2).Text)) = 0 Then
     MsgBox "该读者已借満图书,不能再借!", vbOKOnly, "信息提示"
     Comm2.Enabled = False
     Exit Sub
  End If
  bno = Trim(Text1(1).Text)
  If bno = "" Then
     MsgBox "图书编号不能为空,请输入", vbOKOnly, "信息提示"
     Comm2.Enabled = False
  Else
     sqltxt = "select * from book where 图书编号='" + bno + "'"
     Set bs = exesql(sqltxt)
     If bs.RecordCount = 0 Then
        MsgBox "图书编号不正确,请重新输入", vbOKOnly, "信息提示"
     Else
        If bs.Fields("借否") = "借" Then
           MsgBox "该图书编号对应的图书已借出,不能再借!", vbOKOnly, "信息提示"
        Else
           sqltxt = "select * from borrow"
           Set brs = exesql(sqltxt)
           brs.AddNew
           brs.Fields("图书编号") = bno
           brs.Fields("书名") = bs.Fields("书名")
           brs.Fields("作者") = bs.Fields("作者")
           brs.Fields("出版社") = bs.Fields("出版社")
           brs.Fields("借书证号") = rno
           brs.Fields("姓名") = xm
           brs.Fields("单位") = dw
           brs.Fields("借书日期") = Date
           brs.Update
           bs.Fields("借否") = "借"
           bs.Update
           rs.Fields("已借书数") = rs.Fields("已借书数") + 1
           rs.Update
           Text2(2).Text = Str(rs.Fields("借书总数") - rs.Fields("已借书数"))
        End If
      End If
    End If
           
           
End Sub

Private Sub Form_Load()
Comm2.Enabled = False
End Sub

Private Sub retCom_Click()
  Unload Me
End Sub

⌨️ 快捷键说明

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