📄 借阅.frm
字号:
VERSION 5.00
Begin VB.Form 借阅
Caption = "Form1"
ClientHeight = 4155
ClientLeft = 60
ClientTop = 450
ClientWidth = 5385
LinkTopic = "Form1"
ScaleHeight = 4155
ScaleWidth = 5385
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Caption = "方式"
Height = 1575
Left = 240
TabIndex = 6
Top = 120
Width = 4335
Begin VB.OptionButton Option1
Caption = "借书"
Height = 375
Left = 600
Style = 1 'Graphical
TabIndex = 8
Top = 360
Width = 3015
End
Begin VB.OptionButton Option2
Caption = "还书"
Height = 375
Left = 600
Style = 1 'Graphical
TabIndex = 7
Top = 840
Width = 3015
End
End
Begin VB.CommandButton Command2
Caption = "返回"
Height = 375
Left = 3600
TabIndex = 5
Top = 3600
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
Default = -1 'True
Height = 375
Left = 1560
TabIndex = 4
Top = 3600
Width = 1335
End
Begin VB.TextBox Text2
Height = 270
Left = 2520
TabIndex = 3
Top = 2760
Width = 2415
End
Begin VB.TextBox Text1
Height = 270
Left = 2520
TabIndex = 1
Top = 1920
Width = 2460
End
Begin VB.Label Label2
Caption = "图书编号:"
Height = 375
Left = 1440
TabIndex = 2
Top = 2760
Width = 1695
End
Begin VB.Label Label1
Caption = "借书证编号:"
Height = 495
Left = 1440
TabIndex = 0
Top = 1920
Width = 1935
End
End
Attribute VB_Name = "借阅"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "信息输入不全,请重新输入!", , "图书馆管理系统"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End If
Set db = OpenDatabase(App.Path & "\图书001")
Set rs1 = db.OpenRecordset("select 借书证编号,当前借书量,读者姓名 from 读者 where 借书证编号 = '" & Text1.Text & "'")
Set rs2 = db.OpenRecordset("select 图书编号,状态,图书名称 from 图书 where 图书编号 = '" & Text2.Text & "'")
Set rs3 = db.OpenRecordset("书籍上限")
If rs1.BOF = True And rs1.EOF = True Then
MsgBox ("借书证不存在" + vbCrLf + "请重新输入!")
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Else
If rs2.BOF = True And rs2.EOF = True Then
MsgBox ("图书编号输入错误,请重新输入")
Text2.Text = ""
Text2.SetFocus
Else
If rs2.状态 <> "在馆" And Option1.Value = True Then
MsgBox ("该书以被借走!")
Text2.Text = ""
Text2.SetFocus
Else
If rs2.状态 = "在馆" And Option1.Value = False Then
MsgBox ("该书以在书库!")
Text2.Text = ""
Text2.SetFocus
Else
If Option1.Value = False Then
rs1.Edit
rs2.Edit
rs1.当前借书量 = Trim(Val(rs1.当前借书量) - 1)
rs2.状态 = "在馆"
MsgBox ("还书成功")
rs1.Update
rs2.Update
主界面.Text1 = "借阅信息:" + rs1.读者姓名 + "已还" + rs2.Fields("图书名称")
Else
If Option2.Value = False And rs1.当前借书量 < rs3.上限 Then
rs1.Edit
rs2.Edit
m = Val(rs1.当前借书量) + 1
rs1.当前借书量 = Trim(str(m))
rs2.状态 = rs1.借书证编号
MsgBox ("借书成功")
rs1.Update
rs2.Update
主界面.Text1 = "借阅信息:" + rs1.读者姓名 + "借到" + rs2.图书名称
Else
MsgBox ("该用户借书量已达上限")
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End If
End If
End If
End If
End If
End If
Text1.Text = ""
Text2.Text = ""
rs1.Close
rs2.Close
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Option1_Click()
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Option2_Click()
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -