📄 frmaddreader.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmAddReader
BackColor = &H80000013&
Caption = "Form1"
ClientHeight = 6690
ClientLeft = 3495
ClientTop = 2685
ClientWidth = 7830
LinkTopic = "Form1"
ScaleHeight = 6690
ScaleMode = 0 'User
ScaleWidth = 9108.067
Begin VB.CommandButton cmdClear
Appearance = 0 'Flat
Caption = "清 除"
Height = 495
Left = 3360
TabIndex = 30
Top = 6000
Width = 1335
End
Begin VB.CommandButton cmdCancel
Appearance = 0 'Flat
Caption = "取 消"
Height = 495
Left = 5280
TabIndex = 29
Top = 6000
Width = 1335
End
Begin VB.CommandButton amdAdd
Appearance = 0 'Flat
Caption = "添 加"
Height = 495
Left = 1200
TabIndex = 28
Top = 6000
Width = 1335
End
Begin VB.TextBox bz
Height = 1335
Left = 1200
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 27
Top = 4320
Width = 6135
End
Begin VB.TextBox czy
Height = 375
Left = 5040
TabIndex = 26
Top = 3720
Width = 2295
End
Begin VB.TextBox dzyj
Height = 375
Left = 1200
TabIndex = 25
Text = "格式如:wooany.320@163.com"
Top = 3720
Width = 2775
End
Begin VB.TextBox lxdh
Height = 375
Left = 5040
TabIndex = 24
Top = 3120
Width = 2295
End
Begin VB.ComboBox dzbmcomb
Height = 300
ItemData = "frmAddReader.frx":0000
Left = 1200
List = "frmAddReader.frx":0016
TabIndex = 23
Top = 3120
Width = 2175
End
Begin VB.TextBox zjhm
Height = 375
Left = 5040
TabIndex = 22
Top = 2520
Width = 2295
End
Begin VB.ComboBox zjmccomb
Height = 300
ItemData = "frmAddReader.frx":004A
Left = 1200
List = "frmAddReader.frx":0057
TabIndex = 21
Text = "学生证"
Top = 2520
Width = 2175
End
Begin MSComCtl2.DTPicker DTPickerbzrq
Height = 375
Left = 5040
TabIndex = 20
Top = 1920
Width = 2295
_ExtentX = 4048
_ExtentY = 661
_Version = 393216
Format = 25559041
CurrentDate = 39593
End
Begin MSComCtl2.DTPicker DTPickercsrq
Height = 375
Left = 1200
TabIndex = 19
Top = 1920
Width = 2175
_ExtentX = 3836
_ExtentY = 661
_Version = 393216
Format = 25559041
CurrentDate = 39593
End
Begin VB.ComboBox dzlbcomb
Height = 300
ItemData = "frmAddReader.frx":0073
Left = 5040
List = "frmAddReader.frx":0075
TabIndex = 18
Top = 1320
Width = 2295
End
Begin VB.ComboBox dzxbcomb
Height = 300
ItemData = "frmAddReader.frx":0077
Left = 1200
List = "frmAddReader.frx":0081
TabIndex = 17
Text = "男"
Top = 1320
Width = 2175
End
Begin VB.TextBox dzxm
Height = 375
Left = 5040
TabIndex = 16
Top = 720
Width = 2295
End
Begin VB.TextBox dzbh
Height = 375
Left = 1200
TabIndex = 14
Top = 720
Width = 2175
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "*"
ForeColor = &H000000FF&
Height = 255
Left = 3480
TabIndex = 15
Top = 840
Width = 255
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "读者姓名:"
Height = 180
Index = 12
Left = 4200
TabIndex = 13
Top = 840
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "读者性别:"
Height = 180
Index = 11
Left = 360
TabIndex = 12
Top = 1440
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "读者类别:"
Height = 180
Index = 10
Left = 4200
TabIndex = 11
Top = 1440
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "出生日期:"
Height = 180
Index = 9
Left = 360
TabIndex = 10
Top = 2040
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "办证日期:"
Height = 180
Index = 8
Left = 4200
TabIndex = 9
Top = 2040
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "证件名称:"
Height = 180
Index = 7
Left = 360
TabIndex = 8
Top = 2640
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "证件号码:"
Height = 180
Index = 6
Left = 4200
TabIndex = 7
Top = 2640
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "读者部门:"
Height = 180
Index = 5
Left = 360
TabIndex = 6
Top = 3240
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "联系电话:"
Height = 180
Index = 4
Left = 4200
TabIndex = 5
Top = 3240
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "电子邮箱:"
Height = 180
Index = 3
Left = 360
TabIndex = 4
Top = 3840
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "操作员:"
Height = 180
Index = 2
Left = 4200
TabIndex = 3
Top = 3840
Width = 630
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "备 注:"
Height = 180
Index = 1
Left = 360
TabIndex = 2
Top = 4440
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "读者编号:"
Height = 180
Index = 0
Left = 360
TabIndex = 1
Top = 840
Width = 810
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
ForeColor = &H00000000&
Height = 435
Left = 2880
TabIndex = 0
Top = 120
Width = 2250
End
End
Attribute VB_Name = "frmAddReader"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
' 作者:叶和平
' 名称:frmAddReader
' 功能:增加借阅者
'****************************************************************************
Private Sub amdAdd_Click()
Dim rs As New ADODB.Recordset
Dim sql As String
sql = "select * from readers"
Dim sql2 As String
sql2 = "select * from readers where dzbh ='" & dzbh.Text & "'"
If Trim(dzbh.Text) = "" Then
MsgBox "读者编号不能为空!", vbOKOnly
ElseIf Trim(dzxm.Text) = "" Then
MsgBox "读者姓名不能为空!", vbOKOnly
ElseIf Trim(dzlbcomb.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(dzbh.Text)
rs.Fields(1) = Trim(dzxm.Text)
rs.Fields(2) = Trim(dzxbcomb.Text)
rs.Fields(3) = Trim(dzlbcomb.Text)
rs.Fields(4) = Trim(DTPickercsrq.Value)
rs.Fields(5) = Trim(DTPickerbzrq.Value)
rs.Fields(6) = Trim(zjmccomb.Text)
rs.Fields(7) = Val(zjhm.Text)
rs.Fields(8) = Trim(dzbmcomb.Text)
rs.Fields(9) = Val(lxdh.Text)
rs.Fields(10) = Trim(dzyj.Text)
rs.Fields(11) = Trim(bz.Text)
rs.Fields(12) = Trim(czy.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()
'重填读者信息
dzbh.Text = ""
dzxm.Text = ""
dzxbcomb.Text = "请选择性别"
dzlbcomb.Text = "请选择读者类别"
DTPickercsrq = Date
DTPickerbzrq = Date
zjmccomb.Text = "请选择类别"
zjhm.Text = ""
dzbmcomb = "请选择你所在的年级或大队"
lxdh.Text = ""
dzyj.Text = ""
czy.Text = ""
bz.Text = ""
dzbh.SetFocus
End Sub
Private Sub Form_Load()
'添加读者类别名称
sql_lb = "select dzlb from reader_category"
Set rs_lb = ADOSQL(sql_lb)
While Not rs_lb.EOF
dzlbcomb.AddItem rs_lb(0)
rs_lb.MoveNext
Wend
dzbh.Text = ""
dzxm.Text = ""
dzxbcomb.Text = "男"
dzlbcomb.Text = "请选择读者类别"
DTPickercsrq = Date
DTPickerbzrq = Date
zjmccomb.Text = "学生证"
zjhm.Text = ""
dzbmcomb = "05年级"
lxdh.Text = ""
dzyj.Text = "格式如:wooany.320@163.com"
czy.Text = ""
bz.Text = ""
End Sub
'填入信息为数值的判断
Private Sub dzbh_Change()
If Not IsNumeric(dzbh.Text) And dzbh.Text <> "" Then
MsgBox "只能输入数值!如:000001", vbCritical + vbOKOnly, "错误"
dzbh.Text = Val("")
End If
End Sub
Private Sub lxdh_Change()
If Not IsNumeric(lxdh.Text) And lxdh.Text <> "" Then
MsgBox "只能输入数值!", vbCritical + vbOKOnly, "错误"
lxdh.Text = Val("")
End If
End Sub
Private Sub zjhm_Change()
If Not IsNumeric(zjhm.Text) And zjhm.Text <> "" Then
MsgBox "只能输入数值!", vbCritical + vbOKOnly, "错误"
zjhm.Text = Val("")
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -