📄 frmemployeemodify.frm
字号:
Width = 7095
Begin VB.TextBox txtRemark
Height = 270
Left = 240
MaxLength = 30
TabIndex = 14
Top = 240
Width = 6615
End
End
Begin VB.TextBox txtId
Height = 270
Left = 1080
Locked = -1 'True
MaxLength = 8
TabIndex = 0
ToolTipText = "职工编号不能改变"
Top = 960
Width = 1215
End
Begin VB.ComboBox cmbDept
Height = 300
ItemData = "frmEmployeeModify.frx":0157
Left = 3120
List = "frmEmployeeModify.frx":016A
TabIndex = 1
Text = "选择部门"
Top = 960
Width = 1215
End
Begin MSComCtl2.DTPicker dtpWorkDate
Height = 255
Left = 5520
TabIndex = 2
Top = 960
Width = 1335
_ExtentX = 2355
_ExtentY = 450
_Version = 393216
Format = 65470465
CurrentDate = 38588
End
Begin CSCommand.Command cmdSave
Default = -1 'True
Height = 230
Left = 4680
TabIndex = 15
Top = 5520
Width = 1305
_ExtentX = 2302
_ExtentY = 397
PICMaskColor = 49152
IconAlign = 0
Icon = "frmEmployeeModify.frx":0196
Caption = "更 新(&R)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command cmdBack
Cancel = -1 'True
Height = 230
Left = 6120
TabIndex = 16
Top = 5520
Width = 1305
_ExtentX = 2302
_ExtentY = 397
PICMaskColor = 49152
IconAlign = 0
Icon = "frmEmployeeModify.frx":01B2
Caption = "返 回(Ese)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label5
Caption = "修改员工信息"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1440
TabIndex = 35
Top = 120
Width = 4335
End
Begin VB.Label Label4
Caption = "编 号"
Height = 255
Index = 0
Left = 480
TabIndex = 34
Top = 1005
Width = 495
End
Begin VB.Label Label4
Caption = "部 门"
Height = 255
Index = 1
Left = 2520
TabIndex = 33
Top = 1005
Width = 495
End
Begin VB.Label Label6
Caption = "工作日期"
Height = 255
Left = 4680
TabIndex = 32
Top = 1000
Width = 855
End
End
Attribute VB_Name = "frmEmployeeModify"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim EmpStr As String
Private Sub cmdBack_Click()
Unload Me
End Sub
Private Sub cmdSave_Click()
If txtName.Text = "" Then '姓名为空约束
MsgBox "职员姓名不能为空", vbInformation + vbOKOnly, "添加职员"
txtName.SetFocus
Exit Sub
End If
If txtCardid.Text = "" Then '身份证号码为空约束
MsgBox "职员身份证号不能为空", vbInformation + vbOKOnly, "添加职员"
txtCardid.SetFocus
Exit Sub
End If
If txtAddress.Text = "" Then '家庭地址为空约束
MsgBox "职员家庭住址不能为空", vbInformation + vbOKOnly, "添加职员"
txtAddress.SetFocus
Exit Sub
End If
EmpStr = "select * from employee where emp_id='" & mdlCon.EmpId & "' "
If mdlCon.connectTotable(con, rs, EmpStr) Then '打开员工信息表记录
rs!emp_dept = cmbDept.Text
rs!emp_name = txtName.Text
rs!emp_sex = cmbSex.Text
rs!emp_age = cmbAge.Text
rs!emp_nation = cmbNation.Text
rs!emp_cardid = txtCardid.Text
rs!emp_address = txtAddress.Text
rs!emp_graduate = dtpGraduate.Value
rs!emp_school = txtSchool.Text
rs!emp_specialty = txtSpecialty.Text
rs!emp_work1 = txtWork1.Text
rs!emp_work2 = txtWork2.Text
rs!emp_workdate = dtpWorkDate.Value
rs!emp_remark = txtRemark.Text
rs.Update '记录集更新
MsgBox "职员信息更新成功!", vbInformation + vbOKOnly, "信息更新"
Unload Me
End If
End Sub
Private Sub Form_Activate()
txtId.SetFocus
txtId.SelStart = 0
txtId.SelLength = Len(txtId.Text)
End Sub
'窗体加载显示员工信息数据(查询表所传递的员工信息)
Private Sub Form_Load()
EmpStr = "select * from employee where emp_id ='" & mdlCon.EmpId & "'"
If mdlCon.connectTotable(con, rs, EmpStr) Then
txtId.Text = rs!emp_id
cmbDept.Text = rs!emp_dept
dtpWorkDate.Value = rs!emp_workdate
txtName.Text = rs!emp_name
cmbSex.Text = rs!emp_sex
cmbAge.Text = rs!emp_age
cmbNation.Text = rs!emp_nation
txtCardid.Text = rs!emp_cardid
txtAddress.Text = rs!emp_address
dtpGraduate.Value = rs!emp_graduate
txtSchool.Text = rs!emp_school
txtSpecialty.Text = rs!emp_specialty
txtWork1.Text = rs!emp_work1
txtWork2.Text = rs!emp_work2
txtRemark.Text = rs!emp_remark
End If
End Sub
Private Sub txtAddress_GotFocus()
txtAddress.SelStart = 0
txtAddress.SelLength = Len(txtAddress.Text)
End Sub
Private Sub txtCardid_GotFocus()
txtCardid.SelStart = 0
txtCardid.SelLength = Len(txtCardid.Text)
End Sub
Private Sub txtCardid_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 45, 46, vbKey0 To vbKey9, vbKeyBack
Case Else
KeyAscii = 0
MsgBox "请输入15或18位证件号码!"
End Select
End Sub
Private Sub txtName_GotFocus()
txtName.SelStart = 0
txtName.SelLength = Len(txtName.Text)
End Sub
Private Sub txtSchool_GotFocus()
txtSchool.Text = 0
txtSchool.SelLength = Len(txtSchool.Text)
End Sub
Private Sub txtSpecialty_GotFocus()
With txtSpecialty
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub
Private Sub txtWork1_GotFocus()
With txtWork1
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub
Private Sub txtWork2_GotFocus()
With txtWork2
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -