📄 frmborrowlbmanage.frm
字号:
VERSION 5.00
Begin VB.Form frmBorrowLBmanage
BackColor = &H80000013&
Caption = "借阅者类别管理"
ClientHeight = 5265
ClientLeft = 3900
ClientTop = 3075
ClientWidth = 7425
LinkTopic = "Form1"
ScaleHeight = 5265
ScaleWidth = 7425
Begin VB.Frame Frame2
BackColor = &H80000013&
Height = 735
Left = 240
TabIndex = 17
Top = 3840
Width = 6975
Begin VB.CommandButton cmdCancel
Caption = "退 出"
Height = 375
Left = 5760
TabIndex = 21
Top = 240
Width = 975
End
Begin VB.CommandButton cmdClear
Caption = "清 除"
Height = 375
Left = 3840
TabIndex = 20
Top = 240
Width = 975
End
Begin VB.CommandButton cmdDelete
Caption = "删 除"
Height = 375
Left = 2040
TabIndex = 19
Top = 240
Width = 975
End
Begin VB.CommandButton cmdAdd
Caption = "添 加"
Height = 375
Left = 240
TabIndex = 18
Top = 240
Width = 975
End
End
Begin VB.Frame Frame1
BackColor = &H80000013&
Caption = "增加、删除读者类别"
Height = 2295
Left = 240
TabIndex = 2
Top = 1320
Width = 6975
Begin VB.TextBox fkje
Height = 375
Left = 960
TabIndex = 16
Top = 1680
Width = 2055
End
Begin VB.TextBox hcts
Height = 375
Left = 4560
TabIndex = 14
Top = 1200
Width = 1935
End
Begin VB.TextBox xjcs
Height = 375
Left = 960
TabIndex = 12
Top = 1200
Width = 2055
End
Begin VB.TextBox jsts
Height = 375
Left = 4560
TabIndex = 10
Top = 720
Width = 1935
End
Begin VB.TextBox jssl
Height = 375
Left = 960
TabIndex = 8
Top = 720
Width = 2055
End
Begin VB.TextBox dzlb
Height = 375
Left = 4560
TabIndex = 6
Top = 240
Width = 1935
End
Begin VB.TextBox lbbh
Height = 375
Left = 960
TabIndex = 4
Top = 240
Width = 2055
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "罚款金额:"
Height = 180
Index = 6
Left = 120
TabIndex = 15
Top = 1800
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "缓冲天数:"
Height = 180
Index = 5
Left = 3600
TabIndex = 13
Top = 1320
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "续借次数:"
Height = 180
Index = 4
Left = 120
TabIndex = 11
Top = 1320
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "借书天数:"
Height = 180
Index = 3
Left = 3600
TabIndex = 9
Top = 840
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "借书数量:"
Height = 180
Index = 2
Left = 120
TabIndex = 7
Top = 840
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "读者类别:"
Height = 180
Index = 1
Left = 3600
TabIndex = 5
Top = 360
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "类别编号:"
Height = 180
Index = 0
Left = 120
TabIndex = 3
Top = 360
Width = 900
End
End
Begin VB.ComboBox yyreaderlbcomb
Height = 300
Left = 3600
TabIndex = 1
Top = 720
Width = 2415
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "借阅者类别管理"
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 2160
TabIndex = 22
Top = 120
Width = 3150
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "已有的读者类别:"
BeginProperty Font
Name = "隶书"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 1200
TabIndex = 0
Top = 720
Width = 2250
End
End
Attribute VB_Name = "frmBorrowLBmanage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
' 作者:叶和平
' 名称:frmBorrowLBmanage
' 功能:借阅者类别管理
'****************************************************************************
Private Sub cmdAdd_Click() '添加读者类别
Dim rs As New ADODB.Recordset
Dim sql As String
sql = "select * from reader_category"
Dim sql2 As String
sql2 = "select * from reader_category where lbbh ='" & lbbh.Text & "'"
If Trim(lbbh.Text) = "" Then
MsgBox "类别编号不能为空!", vbOKOnly
ElseIf Trim(dzlb.Text) = "" Then
MsgBox "读者类别不能为空!", vbOKOnly
ElseIf Trim(jssl.Text) = "" Then
MsgBox "借书数量不能为空!", vbOKOnly
ElseIf Trim(jsts.Text) = "" Then
MsgBox "借书天数不能为空!", vbOKOnly
ElseIf Trim(xjcs.Text) = "" Then
MsgBox "续借次数不能为空!", vbOKOnly
ElseIf Trim(hcts.Text) = "" Then
MsgBox "缓冲天数不能为空!", vbOKOnly
ElseIf Trim(fkje.Text) = "" Then
MsgBox "罚款金额不能为空!", vbOKOnly
Else
Set rs = ADOSQL(sql2)
If rs.EOF = False Then
MsgBox "该类别编号已经存在,请核对!", vbOKOnly
rs.Close
Else
Set rs = ADOSQL(sql)
rs.AddNew '添加新纪录
rs.Fields(0) = Trim(lbbh.Text)
rs.Fields(1) = Trim(dzlb.Text)
rs.Fields(2) = Val(jssl.Text)
rs.Fields(3) = Val(jsts.Text)
rs.Fields(4) = Val(xjcs.Text)
rs.Fields(5) = Val(hcts.Text)
rs.Fields(6) = Val(fkje.Text)
rs.Update
MsgBox "读者类别添加成功!", vbOKOnly
rs.Close
End If
End If
End Sub
Private Sub cmdCancel_Click() '退出
Unload Me
End Sub
Private Sub cmdClear_Click() '清除记录
lbbh.Text = ""
dzlb.Text = ""
jssl.Text = ""
jsts.Text = ""
xjcs.Text = ""
hcts.Text = ""
fkje.Text = ""
lbbh.SetFocus
End Sub
Private Sub cmdDelete_Click() '删除记录
Dim rs_del As New ADODB.Recordset
Dim sql_del As String
sql_del = "select * from reader_category where lbbh='" & lbbh.Text & "'"
Set rs_del = ADOSQL(sql_del)
If lbbh.Text = "" Then
MsgBox "请在类别编号框里输入要删除的类别编号!"
lbbh.SetFocus
Exit Sub
End If
If rs_del.EOF Then
MsgBox "该类别编号已经不存在!"
Exit Sub
Else
sql_del = "delete from reader_category where lbbh='" & lbbh.Text & "'"
Set rs_del = ADOSQL(sql_del)
MsgBox "删除成功!"
Exit Sub
End If
rs_del.Close
Unload Me
End Sub
Private Sub Form_Load()
'已存在的读者类别名称
sql_lb = "select dzlb from reader_category"
Set rs_lb = ADOSQL(sql_lb)
While Not rs_lb.EOF
yyreaderlbcomb.AddItem rs_lb(0)
rs_lb.MoveNext
Wend
End Sub
'加入的值是否为数值判断
Private Sub lbbh_Change()
If Not IsNumeric(lbbh.Text) And lbbh.Text <> "" Then
MsgBox "只能输入数值!", vbCritical + vbOKOnly, "错误"
lbbh.Text = Val("")
End If
End Sub
Private Sub xjcs_Change()
If Not IsNumeric(xjcs.Text) And xjcs.Text <> "" Then
MsgBox "只能输入数值!", vbCritical + vbOKOnly, "错误"
xjcs.Text = Val("")
End If
End Sub
Private Sub fkje_Change()
If Not IsNumeric(fkje.Text) And fkje.Text <> "" Then
MsgBox "只能输入数值!", vbCritical + vbOKOnly, "错误"
fkje.Text = Val("")
End If
End Sub
Private Sub jsts_Change()
If Not IsNumeric(jsts.Text) And jsts.Text <> "" Then
MsgBox "只能输入数值!", vbCritical + vbOKOnly, "错误"
jsts.Text = Val("")
End If
End Sub
Private Sub hcts_Change()
If Not IsNumeric(hcts.Text) And hcts.Text <> "" Then
MsgBox "只能输入数值!", vbCritical + vbOKOnly, "错误"
hcts.Text = Val("")
End If
End Sub
Private Sub jssl_Change()
If Not IsNumeric(jssl.Text) And jssl.Text <> "" Then
MsgBox "只能输入数值!", vbCritical + vbOKOnly, "错误"
jssl.Text = Val("")
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -