📄 borbook.frm
字号:
VERSION 5.00
Begin VB.Form borbook
Caption = "借书处理"
ClientHeight = 5520
ClientLeft = 60
ClientTop = 435
ClientWidth = 9165
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5520
ScaleWidth = 9165
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame3
Caption = "输入所借图书的图书编号"
Height = 1095
Left = 360
TabIndex = 2
Top = 4080
Width = 8415
Begin VB.CommandButton cmd_back
Caption = "返回"
Height = 375
Left = 6720
TabIndex = 13
Top = 360
Width = 1335
End
Begin VB.CommandButton cmd_ok2
Caption = "确定"
Height = 375
Left = 5160
TabIndex = 12
Top = 360
Width = 1095
End
Begin VB.TextBox txtbno
Height = 615
Left = 960
TabIndex = 11
Text = "Text5"
Top = 240
Width = 3495
End
End
Begin VB.Frame Frame2
Caption = "读者借书情况"
Height = 1935
Left = 360
TabIndex = 1
Top = 1920
Width = 8415
Begin VB.TextBox txtcnum
Height = 735
Left = 6600
TabIndex = 7
Text = "Text4"
Top = 600
Width = 1455
End
Begin VB.TextBox txtrsum
Height = 735
Left = 3840
TabIndex = 6
Text = "Text3"
Top = 600
Width = 1455
End
Begin VB.TextBox txtname
Height = 735
Left = 960
TabIndex = 5
Text = "Text2"
Top = 600
Width = 1575
End
Begin VB.Label Label3
Caption = "可借书数"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 5400
TabIndex = 10
Top = 720
Width = 1335
End
Begin VB.Label Label2
Caption = "借书总数"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2640
TabIndex = 9
Top = 720
Width = 1215
End
Begin VB.Label Label1
Caption = "姓名"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 8
Top = 720
Width = 735
End
End
Begin VB.Frame Frame1
Caption = "输入借书证号"
Height = 1335
Left = 360
TabIndex = 0
Top = 240
Width = 8415
Begin VB.CommandButton cmd_ok1
Caption = "确定"
Height = 615
Left = 6840
TabIndex = 4
Top = 360
Width = 1095
End
Begin VB.TextBox txtrno
Height = 735
Left = 720
TabIndex = 3
Text = "Text1"
Top = 360
Width = 5535
End
End
End
Attribute VB_Name = "borbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public rno As String
Public bno As String
Public xm As String
Public dw As String
Public rstseek As ADODB.Recordset
Private Sub form_load()
cmd_ok2.Enabled = False
End Sub
Private Sub cmd_ok1_click()
rno = Trim(txtrno.Text)
If rno = "" Then
MsgBox "借书证号不能为空,请输入!", vbOKOnly, "信息提示"
cmd_ok2.Enabled = False
Else
txtsql = "select * from reader where 借书证号='" + rno + "'"
Set rstseek = exesql(txtsql)
If rstseek.EOF = True Then
MsgBox "该读者未登记,不能借书!", vbOKOnly, "信息提示"
cmd_ok2.Enabled = False
Else
txt.Name.Text = rstseek.Fields("姓名")
txtrsum.Text = str(rstseek.Fields("借书总数"))
txtcnum.Text = str(rstseek.Fields("借书总数") - rstseek.Fields("已借书数"))
If Val(Trim(txtcnum.Text)) > 0 Then
xm = rstseek.Fields("姓名")
dw = rstseek.Fields("单位")
cmd_ok2.Enabled = True
Else
MsgBox "已借满图书,不能再借!", vbOKOnly, "信息提示"
cmd_ok2.Enabled = False
End If
End If
End If
End Sub
Private Sub cmd_ok2_click()
If Val(Trim(txtcnum.Text)) = 0 Then
MsgBox "该读者已借满图书,不能再借!", vbOKOnly, "信息提示"
cmd_ok2.Enabled = False
Exit Sub
End If
If bno = "" Then
MsgBox "图书编号不能为空,请输入", vbOKOnly, "信息提示"
Else
Dim rstfind As ADODB.Recordset
Dim rstadd As ADODB.Recordset
txtsql = "select * from book where 图书编号='" + bno + "'"
Set rstfind = exesql(txtsql)
If rstfind.EOF = True Then
MsgBox "图书编号不正确,请重新输入", vbOKOnly, "信息提示"
cmd_ok2.Enabled = False
Else
If rstfind.Fields("借否") = "借" Then
MsgBox "该图书已借出,不能再借!", vbOKOnly, "信息提示"
Else
txtsql1 = "select * from borrow"
Set rstadd = exesql(txtsql)
rstadd.AddNew
rstadd.Fields("图书编号") = bno
rstadd.Fields("书名") = rstfind.Fields("书名")
rstadd.Fields("作者") = rstfind.Fields("作者")
rstadd.Fields("出版社") = rstfind.Fields("出版社")
rstadd.Fields("借书证号") = rno
rstadd.Fields("姓名") = xm
rstadd.Fields("单位") = dw
rstadd.Fields("借书日期") = Data
rstadd.Update
rstseek.Fields("已借书数") = rstseek.Fields("已借书数") + 1
rstseek.Update
txtcnum.Text = str(rstseek.Fields("借书总数") - rstseek.Fields("已借书数"))
End If
End If
End If
End Sub
Private Sub cmd_back_click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -