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

📄 borbook.frm

📁 简单的图书管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form borbook 
   Caption         =   "图书借阅"
   ClientHeight    =   6195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8085
   ForeColor       =   &H8000000D&
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6195
   ScaleWidth      =   8085
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command3 
      BackColor       =   &H8000000D&
      Caption         =   "返回"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2040
      MaskColor       =   &H8000000D&
      TabIndex        =   13
      Top             =   4800
      Width           =   735
   End
   Begin VB.Frame Frame3 
      Caption         =   "输入所借图书的图书编号"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000D&
      Height          =   1935
      Left            =   4080
      TabIndex        =   4
      Top             =   3240
      Width           =   3615
      Begin VB.CommandButton Command2 
         Caption         =   "确定"
         Height          =   375
         Left            =   2280
         TabIndex        =   11
         Top             =   1320
         Width           =   615
      End
      Begin VB.TextBox Text5 
         Height          =   375
         Left            =   600
         TabIndex        =   10
         Text            =   "Text5"
         Top             =   600
         Width           =   2295
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "读者借书情况"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000D&
      Height          =   3495
      Left            =   240
      TabIndex        =   3
      Top             =   960
      Width           =   3615
      Begin VB.TextBox Text4 
         Height          =   375
         Left            =   1920
         TabIndex        =   9
         Text            =   "Text4"
         Top             =   2520
         Width           =   1335
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   1920
         TabIndex        =   8
         Text            =   "Text3"
         Top             =   1560
         Width           =   1335
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   1920
         TabIndex        =   7
         Text            =   "Text2"
         Top             =   720
         Width           =   1215
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "可借书数"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   13.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   360
         Left            =   360
         TabIndex        =   12
         Top             =   2520
         Width           =   1200
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "借书总数"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   13.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   360
         Left            =   360
         TabIndex        =   6
         Top             =   1560
         Width           =   1200
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "姓名"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   13.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   360
         Left            =   360
         TabIndex        =   5
         Top             =   720
         Width           =   600
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "输入借书证号"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000D&
      Height          =   2175
      Left            =   4080
      TabIndex        =   0
      Top             =   360
      Width           =   3615
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   375
         Left            =   2400
         TabIndex        =   2
         Top             =   1440
         Width           =   615
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   480
         TabIndex        =   1
         Text            =   "Text1"
         Top             =   720
         Width           =   2535
      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 Command1_Click()
rno = Trim(Text1.Text)
If rno = "" Then
    MsgBox "借阅证号不能为空", vbOKOnly, "信息提示"
    Command2.Enabled = False
Else
    sqltxt = "select * from reader where 借阅证号='" + rno + "'"
    Set rs = exesql(sqltxt)
    If rs.RecordCount = 0 Then
        MsgBox "该读者未登记,无法借书", vbOKOnly, "信息提示"
        Text2.Text = ""
        Text3.Text = ""
        Text4.Text = ""
        Command2.Enabled = False
    Else
        Text2.Text = rs.Fields("姓名")
        Text3.Text = Str(rs.Fields("借书总数"))
        Text4.Text = Str(rs.Fields("借书总数") - rs.Fields("已借书数"))
        If Val(Trim(Text4.Text)) > 0 Then
            xm = rs.Fields("姓名")
            dw = rs.Fields("单位")
            Command2.Enabled = True
        Else
            MsgBox "该读者以借满图书,不能再借", vbOKOnly, "信息提示"
            Text5.Text = ""
            Command2.Enabled = False
        End If
    End If
End If
End Sub

Private Sub Command2_Click()
If Val(Trim(Text4.Text)) = 0 Then
    MsgBox "该读者以借满图书,不能再借", vbOKOnly, "信息提示"
    Command2.Enabled = False
    Exit Sub
End If
bno = Trim(Text5.Text)
If bno = "" Then
    MsgBox "图书编号不能为空,请输入图书编号", vbOKOnly, "信息提示"
    Command2.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
            Text4.Text = Str(rs.Fields("借书总数") - rs.Fields("已借书数"))
        End If
    End If
End If
    
 
End Sub

Private Sub Command3_Click()
Unload Me

End Sub

Private Sub Form_Load()
Command2.Enabled = False
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub

⌨️ 快捷键说明

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