📄 ͼ
字号:
VERSION 5.00
Begin VB.Form 图书借阅
BorderStyle = 1 'Fixed Single
Caption = "借书处理"
ClientHeight = 4095
ClientLeft = 45
ClientTop = 435
ClientWidth = 3855
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4095
ScaleWidth = 3855
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame3
Caption = "输入所借图书的图书编号"
Height = 855
Left = 600
TabIndex = 2
Top = 2880
Width = 2655
Begin VB.CommandButton Command2
Caption = "确定"
Height = 255
Left = 1920
TabIndex = 6
Top = 360
Width = 615
End
Begin VB.TextBox Text5
Height = 270
Left = 120
TabIndex = 5
Top = 360
Width = 1455
End
End
Begin VB.Frame Frame2
Caption = "读者借书情况"
Height = 1455
Left = 600
TabIndex = 1
Top = 1200
Width = 2655
Begin VB.Label Label6
BackColor = &H80000009&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 1080
TabIndex = 12
Top = 1080
Width = 1215
End
Begin VB.Label Label5
BackColor = &H80000009&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 1080
TabIndex = 11
Top = 720
Width = 1215
End
Begin VB.Label Label4
BackColor = &H80000009&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 1080
TabIndex = 10
Top = 360
Width = 1215
End
Begin VB.Label Label3
Caption = "可借书数"
Height = 255
Left = 120
TabIndex = 9
Top = 1080
Width = 735
End
Begin VB.Label Label2
Caption = "借书总数"
Height = 255
Left = 120
TabIndex = 8
Top = 720
Width = 855
End
Begin VB.Label Label1
Caption = "姓 名"
Height = 255
Left = 120
TabIndex = 7
Top = 360
Width = 735
End
End
Begin VB.Frame Frame1
Caption = "输入借书证号"
Height = 855
Left = 600
TabIndex = 0
Top = 120
Width = 2655
Begin VB.CommandButton Command1
Caption = "确定"
Height = 255
Left = 1800
TabIndex = 4
Top = 360
Width = 735
End
Begin VB.TextBox Text1
Height = 270
Left = 120
TabIndex = 3
Top = 360
Width = 1455
End
End
End
Attribute VB_Name = "图书借阅"
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, "信息提示"
Command2.Enabled = False
Else
Label4.Caption = rs.Fields("姓名")
Label5.Caption = Str(rs.Fields("借书总数")) - 0
Label6.Caption = Str(rs.Fields("借书总数")) - rs.Fields("已借书数")
If Val(Trim(Label6.Caption)) > 0 Then
xm = rs.Fields("姓名")
dw = rs.Fields("单位")
Command2.Enabled = True
Else
MsgBox "该读者已借满图书,不能再借!", vbOKOnly, "信息提示"
Command2.Enabled = False
End If
End If
End If
End Sub
Private Sub Command2_Click() '输入图书编号确定
If Val(Trim(Label6.Caption)) = 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
End If
End If
End If
Label6.Caption = Str(rs.Fields("借书总数") - rs.Fields("已借书数"))
End Sub
Private Sub Form_Load()
Command2.Enabled = False
End Sub
Private Sub Frame3_DragDrop(Source As Control, X As Single, Y As Single)
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -