📄 form5.frm
字号:
VERSION 5.00
Begin VB.Form Form5
BorderStyle = 0 'None
Caption = "新增职工界面"
ClientHeight = 7230
ClientLeft = 0
ClientTop = 0
ClientWidth = 8985
ClipControls = 0 'False
LinkTopic = "Form5"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7230
ScaleWidth = 8985
ShowInTaskbar = 0 'False
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Form5.frx":0000
Left = 2160
List = "Form5.frx":000A
TabIndex = 21
Text = "请选择"
Top = 1680
Width = 1455
End
Begin VB.TextBox Text8
Height = 375
Left = 5160
TabIndex = 20
Top = 1680
Width = 1095
End
Begin VB.OptionButton Option2
Caption = "职工"
Height = 255
Left = 3960
TabIndex = 16
Top = 4080
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "管理员"
Height = 255
Left = 2160
TabIndex = 15
Top = 4080
Width = 1215
End
Begin VB.TextBox Text7
Height = 375
IMEMode = 3 'DISABLE
Left = 2160
TabIndex = 14
Top = 5400
Width = 1935
End
Begin VB.TextBox Text6
Height = 375
IMEMode = 3 'DISABLE
Left = 2160
TabIndex = 12
Top = 4680
Width = 1935
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 615
Left = 2400
TabIndex = 9
Top = 6360
Width = 1335
End
Begin VB.TextBox Text1
Height = 375
Left = 2040
TabIndex = 8
Top = 360
Width = 3375
End
Begin VB.TextBox Text5
Height = 375
Left = 2040
TabIndex = 7
Top = 3360
Width = 3975
End
Begin VB.TextBox Text4
Height = 495
Left = 2040
TabIndex = 6
Top = 2400
Width = 3855
End
Begin VB.TextBox Text2
Height = 375
Left = 2040
TabIndex = 2
Top = 960
Width = 3375
End
Begin VB.Label Label11
Caption = "年龄"
Height = 375
Left = 4560
TabIndex = 19
Top = 1800
Width = 495
End
Begin VB.Label Label10
Caption = "5位 "
Height = 375
Left = 5880
TabIndex = 18
Top = 360
Width = 375
End
Begin VB.Label Label9
Caption = "(1——10位)"
Height = 375
Left = 4680
TabIndex = 17
Top = 4680
Width = 1575
End
Begin VB.Label Label8
Caption = "确认密码"
Height = 375
Left = 720
TabIndex = 13
Top = 5400
Width = 975
End
Begin VB.Label Label7
Caption = "密码"
Height = 255
Left = 720
TabIndex = 11
Top = 4800
Width = 975
End
Begin VB.Label Label6
Caption = "权限"
Height = 255
Left = 720
TabIndex = 10
Top = 4080
Width = 855
End
Begin VB.Label Label5
Caption = "身份证号码"
Height = 255
Left = 720
TabIndex = 5
Top = 3480
Width = 975
End
Begin VB.Label Label4
Caption = "地址"
Height = 255
Left = 720
TabIndex = 4
Top = 2520
Width = 975
End
Begin VB.Label Label3
Caption = "性别"
Height = 255
Left = 720
TabIndex = 3
Top = 1800
Width = 975
End
Begin VB.Label Label2
Caption = "姓名"
Height = 255
Left = 720
TabIndex = 1
Top = 1080
Width = 975
End
Begin VB.Label Label1
Caption = "编号"
Height = 255
Left = 720
TabIndex = 0
Top = 360
Width = 975
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim authority As String
Dim audit As Integer
Private Sub Command1_Click()
audit = 0
If Len(Text1.Text) <> 5 Or Text1.Text = "" Then
MsgBox "输入编号不对"
audit = 1
End If
cmd.CommandText = "select employee_id from xinxi0504_23_employee where employee_id='" & Trim(Text1.Text) & "'"
Set rs = cmd.Execute
If Text2.Text = "" Or Len(Text2.Text) > 8 Then
MsgBox "输入姓名不对"
audit = 1
ElseIf Combo1.Text = "" Or Combo1.Text = "请选择" Then
MsgBox "请选择性别"
audit = 1
ElseIf Text8.Text = "" Or Len(Text8.Text) > 3 Then
MsgBox "输入年龄不对"
audit = 1
ElseIf Text4.Text = "" Then
MsgBox "输入地址不对"
audit = 1
ElseIf Text5.Text = "" Or Len(Text5.Text) <> 18 Then
MsgBox "输入身份证不对"
audit = 1
ElseIf Option1.Value = False And Option2.Value = False Then
MsgBox "请设置权限"
audit = 1
End If
If Option1.Value = True Then
authority = "管理员"
Else
authority = "职工"
End If
If Text6.Text = "" Or Len(Text6.Text) > 10 Then
MsgBox "输入密码不对"
audit = 1
ElseIf Text7.Text <> Text6.Text Then
MsgBox "两次密码输入不一样"
Text7.Text = ""
audit = 1
ElseIf rs.EOF = False Then
MsgBox "编号已经存在,请重新输入"
audit = 1
End If
If audit = 0 Then
cmd.CommandText = "insert into xinxi0504_23_employee values('" & Trim(Text1.Text) & "'," + _
"'" & Trim(Text2.Text) & "'," + _
"'" & Trim(Combo1.Text) & "'," + _
"" & Val(Text8.Text) & "," + _
"'" & Trim(Text4.Text) & "'," + _
"'" & Trim(Text5.Text) & "'," + _
"'" & authority & "'," + _
"'" & Trim(Text6.Text) & "')"
cmd.Execute
MsgBox "插入信息成功"
Form4.Show
Unload Form5
End If
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Combo1.Text = "请选择"
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text6.PasswordChar = "*"
Text7.PasswordChar = "*"
Option1.Value = False
Option2.Value = False
Set rs = New ADODB.Recordset
cmd.CommandType = adCmdText
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -