📄 frmmodifyemployee.frm
字号:
Height = 255
Index = 57
Left = 3960
TabIndex = 39
Top = 1695
Width = 1815
End
Begin VB.Label lblLabels
Caption = "所在街道办事处:"
Height = 255
Index = 58
Left = 3960
TabIndex = 38
Top = 3315
Width = 1575
End
Begin VB.Label Label2
Caption = "*"
Height = 255
Left = 1680
TabIndex = 37
Top = 480
Width = 135
End
Begin VB.Label Label3
Caption = "*"
Height = 255
Left = 1560
TabIndex = 36
Top = 2640
Width = 135
End
Begin VB.Label Label4
Caption = "*"
Height = 255
Left = 5280
TabIndex = 35
Top = 480
Width = 135
End
End
Begin VB.Frame Frame3
Caption = "修改员工信息"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1092
Left = 120
TabIndex = 5
Top = 6000
Width = 11295
Begin VB.CommandButton editCommand
Caption = "修改记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 960
TabIndex = 9
Top = 360
Width = 1470
End
Begin VB.CommandButton updateCommand
Caption = "保存记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 3480
TabIndex = 8
Top = 360
Width = 1470
End
Begin VB.CommandButton cancelCommand
Caption = "关闭退出"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 8520
TabIndex = 7
Top = 360
Width = 1695
End
Begin VB.CommandButton deleteCommand
Caption = "删除记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 6000
TabIndex = 6
Top = 390
Width = 1470
End
End
Begin VB.Frame Frame2
Caption = "查看员工信息"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1092
Left = 120
TabIndex = 0
Top = 4680
Width = 11295
Begin VB.CommandButton firstCommand
Caption = "第一条记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 960
TabIndex = 4
Top = 360
Width = 1452
End
Begin VB.CommandButton previousCommand
Caption = "上一条记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 3480
TabIndex = 3
Top = 360
Width = 1452
End
Begin VB.CommandButton nextCommand
Caption = "下一条记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 6000
TabIndex = 2
Top = 360
Width = 1452
End
Begin VB.CommandButton lastCommand
Caption = "最后一条记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 8520
TabIndex = 1
Top = 360
Width = 1692
End
End
End
Attribute VB_Name = "frmModifyEmployee"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mrc As ADODB.Recordset
Dim myBookmark As Variant
Dim mcclean As Boolean
Private Sub cancelCommand_Click()
Unload Me
End Sub
Private Sub deleteCommand_Click()
If UserName <> "Admin" Then
'判断用户的权限
MsgBox "只有超级管理员才有此权限!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
If MsgBox("是否删除当前记录?", vbOKCancel, "删除当前记录") = vbOK Then
mrc.Delete
mrc.MoveFirst
Call viewData
Else
Call viewData
End If
End Sub
Private Sub editCommand_Click()
Frame2.Enabled = False
firstCommand.Enabled = False
previousCommand.Enabled = False
nextCommand.Enabled = False
lastCommand.Enabled = False
Dim i As Integer
txtEmployeeID.Enabled = False
txtName.Enabled = True
txtSex.Enabled = True
txtBirthDay.Enabled = True
txtNation.Enabled = True
txtMarriage.Enabled = True
txtStatus.Enabled = True
txtDegree.Enabled = True
txtEnterCom.Enabled = True
txtForm.Enabled = True
txtDepartment.Enabled = True
txtPosition.Enabled = True
txtHomeTown.Enabled = True
txtBirthPlace.Enabled = True
txtLivingPlace.Enabled = True
txtId.Enabled = True
txtMajor.Enabled = True
txtGraduateCol.Enabled = True
txtRank.Enabled = True
txtAddress.Enabled = True
txtStreet.Enabled = True
txtZip.Enabled = True
txtTel.Enabled = True
txtCellPhone.Enabled = True
txtCoupleName.Enabled = True
txtCoupleUnit.Enabled = True
txtCoupleTel.Enabled = True
End Sub
Private Sub Form_Load()
Dim txtSQL As String
Dim MsgText As String
txtSQL = "select * from 员工基本信息"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.MoveFirst
Call viewData
'显示记录信息
'下面的代码设置记录为只读
txtEmployeeID.Enabled = False
txtName.Enabled = False
txtSex.Enabled = False
txtBirthDay.Enabled = False
txtNation.Enabled = False
txtMarriage.Enabled = False
txtStatus.Enabled = False
txtDegree.Enabled = False
txtEnterCom.Enabled = False
txtForm.Enabled = False
txtDepartment.Enabled = False
txtPosition.Enabled = False
txtHomeTown.Enabled = False
txtBirthPlace.Enabled = False
txtLivingPlace.Enabled = False
txtId.Enabled = False
txtMajor.Enabled = False
txtGraduateCol.Enabled = False
txtRank.Enabled = False
txtAddress.Enabled = False
txtStreet.Enabled = False
txtZip.Enabled = False
txtTel.Enabled = False
txtCellPhone.Enabled = False
txtCoupleName.Enabled = False
txtCoupleUnit.Enabled = False
txtCoupleTel.Enabled = False
End Sub
Public Sub viewData()
txtEmployeeID.Text = mrc.Fields(0)
txtName.Text = mrc.Fields(1)
txtSex.Text = mrc.Fields(2)
txtBirthDay.Text = mrc.Fields(3)
txtNation.Text = mrc.Fields(4)
txtMarriage.Text = mrc.Fields(5)
txtStatus.Text = mrc.Fields(6)
txtDegree.Text = mrc.Fields(7)
txtEnterCom.Text = mrc.Fields(8)
txtForm.Text = mrc.Fields(9)
txtDepartment.Text = mrc.Fields(10)
txtPosition.Text = mrc.Fields(11)
txtHomeTown.Text = mrc.Fields(12)
txtBirthPlace.Text = mrc.Fields(13)
txtLivingPlace.Text = mrc.Fields(14)
txtId.Text = mrc.Fields(15)
txtMajor.Text = mrc.Fields(16)
txtGraduateCol.Text = mrc.Fields(17)
txtRank.Text = mrc.Fields(18)
txtAddress.Text = mrc.Fields(19)
txtStreet.Text = mrc.Fields(20)
txtZip.Text = mrc.Fields(21)
txtTel.Text = mrc.Fields(22)
txtCellPhone.Text = mrc.Fields(23)
txtCoupleName.Text = mrc.Fields(24)
txtCoupleUnit.Text = mrc.Fields(25)
txtCoupleTel.Text = mrc.Fields(26)
End Sub
Private Sub firstCommand_Click()
'第一条记录
mrc.MoveFirst
Call viewData
End Sub
Private Sub previousCommand_Click()
'前一条记录
mrc.MovePrevious
If mrc.BOF Then
mrc.MoveLast
End If
Call viewData
End Sub
Private Sub nextCommand_Click()
'下一条记录
mrc.MoveNext
If mrc.EOF Then
mrc.MoveFirst
End If
Call viewData
End Sub
Private Sub lastCommand_Click()
'最后一条记录
mrc.MoveLast
Call viewData
End Sub
Private Sub updateCommand_Click()
If UserName <> "Admin" Then
'判断用户的权限
MsgBox "只有超级管理员才有此权限!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
'更新记录
mrc.Fields(1) = Trim(txtName.Text)
mrc.Fields(2) = Trim(txtSex.Text)
mrc.Fields(3) = txtBirthDay.Text
mrc.Fields(4) = Trim(txtNation.Text)
mrc.Fields(5) = Trim(txtMarriage.Text)
mrc.Fields(6) = Trim(txtStatus.Text)
mrc.Fields(7) = Trim(txtDegree.Text)
mrc.Fields(8) = Trim(txtEnterCom.Text)
mrc.Fields(9) = Trim(txtForm.Text)
mrc.Fields(10) = Trim(txtDepartment.Text)
mrc.Fields(11) = Trim(txtPosition.Text)
mrc.Fields(12) = Trim(txtHomeTown.Text)
mrc.Fields(13) = Trim(txtBirthPlace.Text)
mrc.Fields(14) = Trim(txtLivingPlace.Text)
mrc.Fields(15) = Trim(txtId.Text)
mrc.Fields(16) = Trim(txtMajor.Text)
mrc.Fields(17) = Trim(txtGraduateCol.Text)
mrc.Fields(18) = Trim(txtRank.Text)
mrc.Fields(19) = Trim(txtAddress.Text)
mrc.Fields(20) = Trim(txtStreet.Text)
mrc.Fields(21) = Trim(txtZip.Text)
mrc.Fields(22) = Trim(txtTel.Text)
mrc.Fields(23) = Trim(txtCellPhone.Text)
mrc.Fields(24) = Trim(txtCoupleName.Text)
mrc.Fields(25) = Trim(txtCoupleUnit.Text)
mrc.Fields(26) = Trim(txtCoupleTel.Text)
mrc.Update
MsgBox "员工信息更新成功!", vbOKOnly + vbExclamation, "更新员工信息"
Call viewData
Frame2.Enabled = True
'导航按钮有效
firstCommand.Enabled = True
previousCommand.Enabled = True
nextCommand.Enabled = True
lastCommand.Enabled = True
'记录只读
txtEmployeeID.Enabled = False
txtName.Enabled = False
txtSex.Enabled = False
txtBirthDay.Enabled = False
txtNation.Enabled = False
txtMarriage.Enabled = False
txtStatus.Enabled = False
txtDegree.Enabled = False
txtEnterCom.Enabled = False
txtForm.Enabled = False
txtDepartment.Enabled = False
txtPosition.Enabled = False
txtHomeTown.Enabled = False
txtBirthPlace.Enabled = False
txtLivingPlace.Enabled = False
txtId.Enabled = False
txtMajor.Enabled = False
txtGraduateCol.Enabled = False
txtRank.Enabled = False
txtAddress.Enabled = False
txtStreet.Enabled = False
txtZip.Enabled = False
txtTel.Enabled = False
txtCellPhone.Enabled = False
txtCoupleName.Enabled = False
txtCoupleUnit.Enabled = False
txtCoupleTel.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -