📄 frmmaninfo.frm
字号:
Index = 13
Left = 960
TabIndex = 1
Top = 1680
Width = 495
End
Begin VB.Label Label1
Caption = "民族:"
Height = 255
Left = 1560
TabIndex = 22
Top = 960
Width = 615
End
Begin VB.Label Label2
Caption = "姓名:"
Height = 255
Left = 1560
TabIndex = 21
Top = 240
Width = 615
End
Begin VB.Label Label3
Caption = "编号:"
Height = 255
Left = 120
TabIndex = 20
Top = 240
Width = 615
End
Begin VB.Label Label4
Caption = "性别:"
Height = 255
Left = 1560
TabIndex = 19
Top = 600
Width = 615
End
Begin VB.Label Label5
Caption = "部门:"
Height = 255
Left = 120
TabIndex = 18
Top = 600
Width = 615
End
Begin VB.Label Label6
Caption = "生日:"
Height = 255
Left = 120
TabIndex = 17
Top = 960
Width = 615
End
Begin VB.Label Label7
Caption = "婚否:"
Height = 255
Left = 120
TabIndex = 16
Top = 1320
Width = 615
End
Begin VB.Label Label8
Caption = "籍 贯:"
Height = 255
Left = 120
TabIndex = 15
Top = 2400
Width = 1095
End
Begin VB.Label Label9
Caption = "学历:"
Height = 255
Left = 1560
TabIndex = 14
Top = 1320
Width = 615
End
Begin VB.Label Label10
Caption = "专 业:"
Height = 255
Left = 120
TabIndex = 13
Top = 2040
Width = 1095
End
Begin VB.Label Label11
Caption = "政治面貌:"
Height = 255
Left = 120
TabIndex = 12
Top = 1680
Width = 1095
End
Begin VB.Label Label14
Caption = "职称:"
Height = 255
Left = 1560
TabIndex = 11
Top = 1680
Width = 615
End
End
End
Attribute VB_Name = "frmManInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdSave_Click()
Dim intCount As Integer
'验证重要信息已经填写
If txtItem(0).Text = "" Then
MsgBox "请填写编号!", vbOKOnly + vbInformation, "注意"
txtItem(0).SetFocus
Exit Sub
ElseIf txtItem(1) = "" Then
MsgBox "请填写姓名!", vbOKOnly + vbInformation, "注意"
txtItem(1).SetFocus
End If
'判断内容是否为日期格式(生日)
If txtItem(6) <> "" Then
If Not IsDate(txtItem(6)) Then
MsgBox "应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
txtItem(6).SetFocus
Exit Sub
End If
Else
txtItem(6) = #1/1/1900#
End If
'判断内容是否为日期格式(参加工作时间)
If txtItem(10) <> "" Then
If Not IsDate(txtItem(10)) Then
MsgBox "应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
txtItem(10).SetFocus
Exit Sub
End If
Else
txtItem(10) = #1/1/1900#
End If
'判断内容是否为日期格式(职称时间)
If txtItem(12) <> "" Then
If Not IsDate(txtItem(12)) Then
MsgBox "生日应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
txtItem(12).SetFocus
Exit Sub
End If
Else
txtItem(12) = #1/1/1900#
End If
'判断内容是否为日期格式(入党时间)
If txtItem(14) <> "" Then
If Not IsDate(txtItem(14)) Then
MsgBox "生日应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
txtItem(14).SetFocus
Exit Sub
End If
Else
txtItem(14) = #1/1/1900#
End If
'判断内容是否为日期格式(进入公司时间)
If txtItem(16) <> "" Then
If Not IsDate(txtItem(16)) Then
MsgBox "生日应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
txtItem(16).SetFocus
Exit Sub
End If
Else
txtItem(16) = #1/1/1900#
End If
'判断内容是否为日期格式(起薪时间)
If txtItem(17) <> "" Then
If Not IsDate(txtItem(17)) Then
MsgBox "生日应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
txtItem(17).SetFocus
Exit Sub
End If
Else
txtItem(17) = #1/1/1900#
End If
'判断内容是否为日期格式(调入时间)
If txtItem(18) <> "" Then
If Not IsDate(txtItem(18)) Then
MsgBox "生日应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
txtItem(18).SetFocus
Exit Sub
End If
Else
txtItem(18) = #1/1/1900#
End If
DataE.Commands("cmdman").CommandText = "delete from ManInfo where ygid='" & Trim(txtItem(0)) & " '"
DataE.conLibrary.Close
DataE.conLibrary.Open
DataE.cmdMan
'将员工信息加入到中
DataE.conLibrary.Close
DataE.conLibrary.Open
'On Error GoTo exit1
If Not IsExistuser(txtItem(0), "") Then
'添加用户
DataE.cmdAddManInfo txtItem(0), txtItem(1), cmbUnit.Text, cmbSex.Text, txtItem(4), txtItem(5), txtItem(6), txtItem(7), txtItem(8), txtItem(9), txtItem(10), txtItem(11), txtItem(12), txtItem(13), txtItem(14), txtItem(15), txtItem(16), txtItem(17), txtItem(18), txtItem(19), txtItem(20)
MsgBox "注册成功!", vbOKOnly + vbInformation, "注意"
txtItem(0) = ""
txtItem(1) = ""
cmbUnit.ListIndex = 0
cmbSex.ListIndex = 0
For intCount = 4 To 20
txtItem(intCount) = ""
Next intCount
Else
'用户已存在
MsgBox "该编号已经存在!请重新输入一个新的编号", vbOKOnly + vbInformation, "注意"
txtItem(0).Text = ""
txtItem(0).SetFocus
End If
Exit Sub
'错误信息
exit1:
MsgBox "数据未成功写入数据库!", vbOKOnly + vbInformation, "注意"
Exit Sub
End Sub
Private Sub CmdReturn_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim cmdman2 As Command
Dim rsMan2 As Recordset
cmbSex.AddItem "男"
cmbSex.AddItem "女"
With cmbUnit
.AddItem "学生处"
.AddItem "教务处"
.AddItem "财务处"
.AddItem "保卫处"
.AddItem "计算机系"
.AddItem "电气系"
.AddItem "机械系"
.AddItem "外语系"
.AddItem "人文系"
End With
If gintMode = 1 Then
Me.Caption = Me.Caption & "添加"
cmbSex.ListIndex = 0
cmbUnit.ListIndex = 0
ElseIf gintMode = 2 Then
'定义新command对象
Set cmdman2 = New Command
'打开连接
If DataE.conLibrary.State = adStateClose Then
DataE.conLibrary.Open
End If
'设置ActiveConnection属性
cmdman2.ActiveConnection = DataE.conLibrary
'设置CommandText属性
cmdman2.CommandText = sqlStr
Set rsMan2 = cmdman2.Execute
If rsMan2.EOF = False Then
With rsMan2
txtItem(0) = .Fields(0)
txtItem(1) = .Fields(1)
If Not IsNull(!ygdept) Then
cmbUnit.Text = !ygdept
End If
If Not IsNull(!ygsex) Then
cmbSex.Text = !ygsex
End If
For intCount = 3 To 19
If Not IsNull(.Fields(intCount + 1)) Then
txtItem(intCount + 1) = .Fields(intCount + 1)
End If
Next intCount
txtItem(0).Enabled = False
End With
End If
rsMan2.Close
Me.Caption = Me.Caption & "修改"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -