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

📄 borbook.frm

📁 系统实现了图书的添加
💻 FRM
字号:
VERSION 5.00
Begin VB.Form borbook 
   Caption         =   "借书处理"
   ClientHeight    =   8640
   ClientLeft      =   60
   ClientTop       =   420
   ClientWidth     =   9840
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   8640
   ScaleWidth      =   9840
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton recCom 
      Caption         =   "返    回"
      Height          =   375
      Left            =   7920
      TabIndex        =   13
      Top             =   6360
      Width           =   975
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Index           =   2
      Left            =   4920
      TabIndex        =   10
      Top             =   3720
      Width           =   855
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Index           =   1
      Left            =   2880
      TabIndex        =   9
      Top             =   3720
      Width           =   855
   End
   Begin VB.Frame Frame3 
      Caption         =   "读者借书情况"
      Height          =   1815
      Left            =   1560
      TabIndex        =   6
      Top             =   2640
      Width           =   5775
      Begin VB.TextBox Text2 
         Height          =   375
         Index           =   0
         Left            =   1320
         TabIndex        =   7
         Top             =   360
         Width           =   2055
      End
      Begin VB.Label Label3 
         Caption         =   "可借书数"
         Height          =   375
         Left            =   2400
         TabIndex        =   12
         Top             =   1200
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "借书总数"
         Height          =   375
         Left            =   480
         TabIndex        =   11
         Top             =   1200
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "姓    名"
         Height          =   375
         Left            =   480
         TabIndex        =   8
         Top             =   480
         Width           =   855
      End
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Index           =   1
      Left            =   2160
      TabIndex        =   4
      Top             =   5760
      Width           =   3015
   End
   Begin VB.Frame Frame2 
      Caption         =   "输入所借图书的图书编号"
      Height          =   1815
      Left            =   1560
      TabIndex        =   3
      Top             =   5040
      Width           =   5775
      Begin VB.CommandButton Comm2 
         Caption         =   "确    定"
         Height          =   375
         Left            =   4080
         TabIndex        =   5
         Top             =   720
         Width           =   975
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "输入借书证号"
      Height          =   1575
      Left            =   1560
      TabIndex        =   0
      Top             =   480
      Width           =   5775
      Begin VB.CommandButton Comm1 
         Caption         =   "确    定"
         Height          =   375
         Left            =   4080
         TabIndex        =   2
         Top             =   600
         Width           =   975
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Index           =   0
         Left            =   600
         TabIndex        =   1
         Top             =   600
         Width           =   3015
      End
   End
End
Attribute VB_Name = "borbook"
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()
    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, "信息提示"
    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 Sub


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

Private Sub recCom_Click()
    Unload Me
End Sub

⌨️ 快捷键说明

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