📄 formygxxdj.frm
字号:
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 3
EndProperty
Height = 375
Left = 1080
TabIndex = 10
Top = 1440
Width = 2055
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Formygxxdj.frx":0000
Left = 1080
List = "Formygxxdj.frx":000A
TabIndex = 9
Top = 840
Width = 855
End
Begin VB.TextBox Textname
Height = 375
Left = 1080
TabIndex = 8
Top = 240
Width = 2055
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "家庭住址"
Height = 375
Left = 120
TabIndex = 7
Top = 3360
Width = 735
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "联系电话"
Height = 255
Left = 120
TabIndex = 6
Top = 2760
Width = 855
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "身份证号"
Height = 255
Left = 120
TabIndex = 5
Top = 2160
Width = 855
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "出生年月"
Height = 255
Left = 120
TabIndex = 4
Top = 1560
Width = 855
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "性 别"
Height = 255
Left = 120
TabIndex = 3
Top = 960
Width = 855
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "姓 名"
Height = 255
Left = 120
TabIndex = 2
Top = 360
Width = 735
End
End
End
Attribute VB_Name = "Form员工信息登记"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
'判断姓名是否为空
If Textname.Text = "" Then
MsgBox "姓名不能为空!", vbOKOnly + vbExclamation, "警告"
Textname.SetFocus
Exit Sub
End If
'判断性别是否为空
If Len(Trim(Combo1.Text)) = 0 Then
MsgBox "性别不能为空!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
'判断出生年月是否为空
If Textborndate.Text = "" Then
MsgBox "出生年月不能为空!", vbOKOnly + vbExclamation, "警告"
Textborndate.SetFocus
Exit Sub
End If
'判断时间格式是否正确
If Not IsDate(Textborndate.Text) Then
MsgBox "出生年月时间格式错误!(正确格式: 2007-01-13 )", vbOKOnly + vbExclamation, "警告"
Textborndate.Text = ""
Textborndate.SetFocus
Exit Sub
End If
'判断身份证号是否为空
If Textic.Text = "" Then
MsgBox "身份证号不能为空!", vbOKOnly + vbExclamation, "警告"
Textic.SetFocus
Exit Sub
End If
'判断身份证位数是否正确
If Len(Trim(Textic.Text)) <> 18 Then
MsgBox "身份证号格式错误,身份证应为18位!", vbOKOnly + vbExclamation, "警告"
Textic.Text = ""
Textic.SetFocus
Exit Sub
End If
'判断联系电话是否为空
If Texttel.Text = "" Then
MsgBox "联系电话不能为空!", vbOKOnly + vbExclamation, "警告"
Texttel.SetFocus
Exit Sub
End If
'判断家庭住址是否为空
If Textaddress.Text = "" Then
MsgBox "家庭住址不能为空!", vbOKOnly + vbExclamation, "警告"
Textaddress.SetFocus
Exit Sub
End If
'判断员工编号是否为空
If Textid.Text = "" Then
MsgBox "员工编号不能为空!", vbOKOnly + vbExclamation, "警告"
Textid.SetFocus
Exit Sub
End If
'查看数据库看是否有此员工编号存在
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from employermessege where eid='" & Trim(Textid.Text) & "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF = False Then
MsgBox "此员工编号已经存在,不能进行登记!", vbOKOnly + vbExclamation, "警告"
Textid.Text = ""
Textid.SetFocus
Exit Sub
End If
'判断现任职务是否为空
If Textnowduty.Text = "" Then
MsgBox "现任职务不能为空!", vbOKOnly + vbExclamation, "警告"
Textnowduty.SetFocus
Exit Sub
End If
'判断所属部门是否为空
If Textbranch.Text = "" Then
MsgBox "所属部门不能为空!", vbOKOnly + vbExclamation, "警告"
Textbranch.SetFocus
Exit Sub
End If
'判断开始工作时间是否为空
If Textbegintime.Text = "" Then
MsgBox "开始工作时间不能为空!", vbOKOnly + vbExclamation, "警告"
Textbegintime.SetFocus
Exit Sub
End If
'判断时间格式是否正确
If Not IsDate(Textbegintime.Text) Then
MsgBox "开始工作时间格式错误!(正确格式: 2007-01-13 )", vbOKOnly + vbExclamation, "警告"
Textbegintime.Text = ""
Textbegintime.SetFocus
Exit Sub
End If
'判断进单位时间是否为空
If Textintime.Text = "" Then
MsgBox "进单位时间不能为空!", vbOKOnly + vbExclamation, "警告"
Textintime.SetFocus
Exit Sub
End If
'判断时间格式是否正确
If Not IsDate(Textintime.Text) Then
MsgBox "进单位时间格式错误!(正确格式: 2007-01-13 )", vbOKOnly + vbExclamation, "警告"
Textintime.Text = ""
Textintime.SetFocus
Exit Sub
End If
'判断填表时间是否为空
If Textpadtime.Text = "" Then
MsgBox "填表时间不能为空!", vbOKOnly + vbExclamation, "警告"
Textpadtime.SetFocus
Exit Sub
End If
'判断时间格式是否正确
If Not IsDate(Textpadtime.Text) Then
MsgBox "填表时间格式错误!(正确格式: 2007-01-13 )", vbOKOnly + vbExclamation, "警告"
Textpadtime.Text = ""
Textpadtime.SetFocus
Exit Sub
End If
'把各数据输入数据库
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("ename").Value = Trim(Textname.Text)
Adodc1.Recordset.Fields("esex").Value = Trim(Combo1.Text)
Adodc1.Recordset.Fields("eborndate").Value = Trim(Textborndate.Text)
Adodc1.Recordset.Fields("ic").Value = Trim(Textic.Text)
Adodc1.Recordset.Fields("tel").Value = Trim(Texttel.Text)
Adodc1.Recordset.Fields("address").Value = Trim(Textaddress.Text)
Adodc1.Recordset.Fields("eid").Value = Trim(Textid.Text)
Adodc1.Recordset.Fields("nowduty").Value = Trim(Textnowduty.Text)
Adodc1.Recordset.Fields("branch").Value = Trim(Textbranch.Text)
Adodc1.Recordset.Fields("begintime").Value = Trim(Textbegintime.Text)
Adodc1.Recordset.Fields("intime").Value = Trim(Textintime.Text)
Adodc1.Recordset.Fields("padtime").Value = Trim(Textpadtime.Text)
Adodc1.Recordset.Update
MsgBox "恭喜你,员工信息登记提交成功!", vbOKOnly + vbExclamation, "提示"
Form用户管理.Show
Me.Hide
Textname.Text = ""
Textborndate.Text = ""
Textic.Text = ""
Textaddress.Text = ""
Texttel.Text = ""
Textid.Text = ""
Textnowduty.Text = ""
Textbranch.Text = ""
Textbegintime.Text = ""
Textintime.Text = ""
Textpadtime.Text = ""
End Sub
Private Sub Command2_Click()
Textname.Text = ""
Textborndate.Text = ""
Textic.Text = ""
Textaddress.Text = ""
Texttel.Text = ""
Textid.Text = ""
Textnowduty.Text = ""
Textbranch.Text = ""
Textbegintime.Text = ""
Textintime.Text = ""
Textpadtime.Text = ""
End Sub
Private Sub Command3_Click()
Form用户管理.Show
Me.Hide
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -