📄 frmborrowedit.frm
字号:
VERSION 5.00
Begin VB.Form frmBorrowEdit
BackColor = &H00C0C0C0&
Caption = "借阅步骤一"
ClientHeight = 6195
ClientLeft = 4590
ClientTop = 2805
ClientWidth = 8685
LinkTopic = "Form1"
ScaleHeight = 6195
ScaleWidth = 8685
Begin VB.CommandButton cmdCancel
Caption = "取消(&C)"
Height = 735
Left = 4920
TabIndex = 14
Top = 4680
Width = 1815
End
Begin VB.CommandButton cmdNext
Caption = "生成信息(&G)"
Height = 735
Left = 2400
TabIndex = 13
Top = 4680
Width = 1815
End
Begin VB.Frame Frame1
BackColor = &H00C0C0C0&
Caption = "步骤一:填写借阅人信息"
Height = 3375
Left = 360
TabIndex = 0
Top = 480
Width = 7695
Begin VB.TextBox txtBCount
Height = 495
Left = 5160
TabIndex = 9
Top = 2040
Width = 1455
End
Begin VB.TextBox txtMaxCount
Height = 375
Left = 5160
TabIndex = 7
Top = 1320
Width = 1455
End
Begin VB.TextBox txtReader
Height = 375
Left = 5160
TabIndex = 5
Top = 600
Width = 1455
End
Begin VB.TextBox txtMaxDays
Height = 375
Left = 1680
TabIndex = 8
Top = 2160
Width = 1095
End
Begin VB.TextBox txtTypeName
Height = 375
Left = 1680
TabIndex = 6
Top = 1320
Width = 1095
End
Begin VB.TextBox txtCNo
Height = 375
Left = 1680
TabIndex = 4
Top = 600
Width = 1095
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "已经借阅数量"
Height = 495
Left = 3720
TabIndex = 12
Top = 2040
Width = 1335
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "最大借阅数量"
Height = 375
Left = 3720
TabIndex = 11
Top = 1320
Width = 1215
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "姓名"
Height = 375
Left = 3720
TabIndex = 10
Top = 600
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "最多借阅天数"
Height = 495
Left = 240
TabIndex = 3
Top = 2160
Width = 1095
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "类型"
Height = 375
Left = 360
TabIndex = 2
Top = 1320
Width = 855
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "借阅证件编号"
Height = 375
Left = 240
TabIndex = 1
Top = 600
Width = 1215
End
End
End
Attribute VB_Name = "frmBorrowEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'单击"取消"按钮
Private Sub cmdCancel_Click()
Unload Me
End Sub
'单击"生成信息/下一步"按钮
Private Sub cmdNext_Click()
Dim rs As ADODB.Recordset
'若为"生成信息"
If Left(cmdNext.Caption, 4) = "生成信息" Then
'判断框的有效性
If Trim(txtCNo.Text) = "" Then
MsgBox "输入的借阅证号为空", vbInformation, "生成信息"
txtCNo.SetFocus
Exit Sub
End If
'判断是否存在此借阅证号
SQLStr = "select * from CardInfo where CardNo='" + Trim(txtCNo) + "'"
Set rs = SQLQuery(SQLStr)
If rs.EOF Then
MsgBox "无此借阅证号,请输入正确的借阅证号", vbInformation, "生成信息"
txtCNo.SetFocus
txtCNo.SelStart = 0
txtCNo.SelLength = Len(txtCNo.Text)
Exit Sub
End If
'确认此借阅证号为正确的
If MsgBox("是否是此借阅证号借书?" + vbCrLf + "生成其他信息后,该借阅证号将不能被修改", vbQuestion + vbYesNo + vbDefaultButton1, "询问") = vbNo Then
Exit Sub
End If
'对控件属性进行修改
txtCNo.Enabled = False '输入借书证件号后,禁止修改
txtReader.Text = Trim(rs.Fields("reader"))
Dim rst As ADODB.Recordset
SQLStr = "select * from CardType where CTypeID='" + Trim(rs.Fields("CTypeID")) + "'"
Set rst = SQLQuery(SQLStr)
txtTypeName.Text = Trim(rst.Fields("typename"))
txtMaxCount.Text = Str(rst.Fields("MaxCount"))
txtMaxDays.Text = Str(rst.Fields("MaxDays"))
SQLStr = "select count(cardno)as rcount from borrowInfo where Cardno='" + Trim(txtCNo) + "'"
Set rst = SQLQuery(SQLStr)
txtBCount.Text = Trim(rst.Fields("rcount")) '当前读者已借书数目
cmdNext.Caption = " 下一步(&N)"
'输入借书证件号,确定该借书证件的类型所对应的姓名,类型,最大借阅数量,借阅天数,
'已借阅数量,然后将"生成信息"按钮修改为"下一步"按钮
'以下为"下一步"代码
Else
'判断此借阅证是否已经借满书籍
If Val(txtBCount.Text) >= Val(txtMaxCount.Text) Then
MsgBox "此借阅证最多只能借阅" + Trim(txtMaxCount.Text) + "本书" + vbCrLf + "不能再借阅其他书籍", vbInformation, "生成信息"
Unload Me
Exit Sub
End If
'给frmBorrowNextEdit填写内容
frmBrwNextEdit.txtCNo.Text = txtCNo.Text
frmBrwNextEdit.txtReader.Text = txtReader.Text
frmBrwNextEdit.txtBorrowDate.Text = Format(Now, "yyyy-mm-dd")
frmBrwNextEdit.txtReturnDate.Text = Format(Now + Val(txtMaxDays.Text), "yyyy-mm-dd")
frmBrwNextEdit.txtBNo = ""
frmBrwNextEdit.txtBName = ""
frmBrwNextEdit.txtAuthor = ""
frmBrwNextEdit.txtPublisher = ""
frmBrwNextEdit.txtPrice = ""
frmBrwNextEdit.txtTypeName = ""
Me.Visible = False
frmBrwNextEdit.Show 1 '单击"下一步"按钮,则调用第二步窗体frmBrwNextEdit
Unload Me
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -