📄 frmctypeedit.frm
字号:
VERSION 5.00
Begin VB.Form frmCTypeEdit
Caption = "借阅证件编辑"
ClientHeight = 6615
ClientLeft = 4590
ClientTop = 3240
ClientWidth = 8160
LinkTopic = "Form1"
Picture = "frmCTypeEdit.frx":0000
ScaleHeight = 6615
ScaleWidth = 8160
Begin VB.CommandButton cmdCancel
Caption = "取消(&C)"
Height = 615
Left = 4320
TabIndex = 11
Top = 5520
Width = 1335
End
Begin VB.CommandButton cmdOk
Caption = "确定(&O)"
Height = 615
Left = 2040
TabIndex = 10
Top = 5520
Width = 1335
End
Begin VB.TextBox txtRenewDays
BackColor = &H00C0FFC0&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 3960
TabIndex = 9
Top = 4200
Width = 2055
End
Begin VB.TextBox txtMaxDays
BackColor = &H00C0FFC0&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 3960
TabIndex = 8
Top = 3240
Width = 2055
End
Begin VB.TextBox txtMaxCount
BackColor = &H00C0FFC0&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 3960
TabIndex = 7
Top = 2280
Width = 2055
End
Begin VB.TextBox txtTypeName
BackColor = &H00C0FFC0&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 3960
TabIndex = 6
Top = 1320
Width = 2055
End
Begin VB.TextBox txtCType
BackColor = &H00C0FFC0&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3960
TabIndex = 5
Top = 480
Width = 2055
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "最多续借天数"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 615
Left = 1920
TabIndex = 4
Top = 4200
Width = 1575
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "最多借阅天数"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 495
Left = 1920
TabIndex = 3
Top = 3360
Width = 1575
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "最大借阅数量"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 495
Left = 1920
TabIndex = 2
Top = 2400
Width = 1575
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "类型名称"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 495
Left = 1920
TabIndex = 1
Top = 1440
Width = 1215
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "类型编号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 495
Left = 1920
TabIndex = 0
Top = 480
Width = 1215
End
End
Attribute VB_Name = "frmCTypeEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SQLStr As String
Dim rs As ADODB.Recordset
Dim oldCTName As String
'取消按钮
Private Sub cmdCancel_Click()
Unload Me
End Sub
'单击"确定"按钮,按输入的信息存储到表CardType中
Private Sub cmdOk_Click()
'是否输入借阅证类型名称
If Trim(txtTypeName.Text) = "" Then
MsgBox " 请输入借阅证类型名称", vbInformation, "信息提示"
txtTypeName.SetFocus
Exit Sub
End If
'是否输入可借阅书籍的数目
If Trim(txtMaxCount.Text) = "" Then
MsgBox "请输入可借阅书籍的数目", vbInformation, "信息提示"
txtMaxCount.SetFocus
Exit Sub
End If
'输入可借阅书籍的数目是否合法
If Not IsNumeric(txtMaxCount.Text) Then
MsgBox "可借阅书籍的数目为数字" + vbCrLf + "请输入正确的可借阅书籍的数目", vbInformation, "信息提示"
txtMaxCount.SetFocus
txtMaxCount.SelStart = 0
txtMaxCount.SelLength = Len(txtMaxCount.Text)
Exit Sub
End If
'是否输入可借阅书籍的时间
If Trim(txtMaxDays.Text) = "" Then
MsgBox "请输入可借阅书籍的时间", vbInformation, "信息提示"
txtMaxDays.SetFocus
Exit Sub
End If
'输入可借阅书籍的时间是否合法
If Not IsNumeric(txtMaxDays.Text) Then
MsgBox "可借阅书籍的时间为数字" + vbCrLf + "请输入正确的可借阅书籍的时间", vbInformation, "信息提示"
txtMaxDays.SetFocus
txtMaxDays.SelStart = 0
txtMaxDays.SelLength = Len(txtMaxDays.Text)
Exit Sub
End If
'是否输入可续借书籍的时间
If Trim(txtRenewDays.Text) = "" Then
MsgBox "请输入可续借书籍的时间", vbInformation, "信息提示"
txtRenewDays.SetFocus
Exit Sub
End If
'输入可续借书籍的时间是否合法
If Not IsNumeric(txtRenewDays.Text) Then
MsgBox "可续借书籍的时间为数字" + vbCrLf + "请输入正确的可续借书籍的时间", vbInformation, "信息提示"
txtRenewDays.SetFocus
txtRenewDays.SelStart = 0
txtRenewDays.SelLength = Len(txtRenewDays.Text)
Exit Sub
End If
If IsAdd Then '添加类型
'是否输入借阅证类型编号
If Trim(txtCType.Text) = "" Then
MsgBox "请输入借阅证类型", vbInformation, "信息提示"
Exit Sub
End If
'输入借阅证类型是否合法
If Not IsNumeric(txtCType.Text) Then
MsgBox "借阅证类型是数字" + vbCrLf + "请输入正确的借阅类型", vbInformation, "信息提示"
txtCType.SetFocus
txtCType.SelStart = 0
txtCType.SelLength = Len(txtCType.Text)
Exit Sub
End If
'判断是否存在此借阅证类型编号
SQLStr = "select * from CardType where CTypeID=" + Trim(txtCType.Text)
Set rs = SQLQuery(SQLStr)
If Not rs.EOF Then
MsgBox Trim(txtCType.Text) + "类型编号已存在" + vbCrLf + "请输入其他借阅类型编号", vbInformation, "信息提示"
Exit Sub
End If
'判断是否存在此借阅证类型名称
If oldCTName <> txtTypeName Then
SQLStr = "select * from CardType where TypeName='" + Trim(txtTypeName.Text) + "'"
Set rs = SQLQuery(SQLStr)
If Not rs.EOF Then
MsgBox Trim(txtTypeName.Text) + "类型名已存在" + vbCrLf + "请输入其他借阅类型名称", vbInformation, "信息提示"
Exit Sub
End If
End If
End If
If IsAdd Then '增加
SQLStr = "insert into CardType values('" + Trim(txtCType) + "','" + Trim(txtTypeName) + "'," + Trim(txtMaxCount) + "," + Trim(txtMaxDays) + "," + Trim(txtRenewDays) + ")"
SQLExt SQLStr '执行inset 语句
MsgBox "插入成功", vbInformation, "信息提示"
Else '修改
If oldCTName <> txtTypeName Then
SQLStr = "select * from CardType where TypeName='" + Trim(txtTypeName.Text) + "'"
Set rs = SQLQuery(SQLStr)
If Not rs.EOF Then
MsgBox Trim(txtTypeName.Text) + "类型名已存在" + vbCrLf + "请输入其他借阅类型名称", vbInformation, "信息提示"
Exit Sub
End If
End If
SQLStr = "update CardType set TypeName='" + Trim(txtTypeName) + "',MaxCount=" + Trim(txtMaxCount) + ",MaxDays=" + Trim(txtMaxDays) + ",RenewDays=" + Trim(txtRenewDays) + "where CTypeID='" + Trim(txtCType) + "'"
SQLExt SQLStr '执行update语句
MsgBox "修改成功", vbInformation, "信息提示"
End If
Unload Me '关闭窗口
End Sub
Private Sub Form_Activate()
oldCTName = txtTypeName
End Sub
Private Sub txtMaxCount_Click()
txtMaxCount.SelStart = 0
txtMaxCount.SelLength = Len(txtMaxCount.Text)
End Sub
Private Sub txtMaxDays_Click()
txtMaxDays.SelStart = 0
txtMaxDays.SelLength = Len(txtMaxDays.Text)
End Sub
Private Sub txtRenewDays_Click()
txtRenewDays.SelStart = 0
txtRenewDays.SelLength = Len(txtRenewDays.Text)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -