www.pudn.com > 考勤管理系统源码(VB含串口接口程序).zip > frmEmploy.frm
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmEmploy
BorderStyle = 3 'Fixed Dialog
Caption = "员工管理"
ClientHeight = 6660
ClientLeft = 45
ClientTop = 330
ClientWidth = 10770
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmEmploy.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6660
ScaleWidth = 10770
StartUpPosition = 2 '屏幕中心
Begin VB.Frame racmd
Height = 6300
Left = 8820
TabIndex = 26
Top = 60
Width = 1710
Begin VB.CommandButton cmdCloseColor
Caption = "关闭颜色"
Height = 450
Left = 255
TabIndex = 27
Top = 4965
Width = 1245
End
Begin VB.CommandButton cmdCard
Caption = "更换卡(&X)"
Height = 450
Index = 3
Left = 195
TabIndex = 15
Top = 4785
Visible = 0 'False
Width = 1365
End
Begin VB.CommandButton cmdCard
Caption = "取消挂失"
Height = 450
Index = 2
Left = 240
TabIndex = 14
Top = 4215
Width = 1245
End
Begin VB.CommandButton cmdCard
Caption = "挂失标记"
Height = 450
Index = 1
Left = 240
TabIndex = 13
Top = 3660
Width = 1245
End
Begin VB.CommandButton cmdCard
Caption = "发卡标记"
Height = 450
Index = 0
Left = 240
TabIndex = 12
Top = 3105
Width = 1245
End
Begin VB.CommandButton cmdEdit
Caption = "添加(&A)"
Height = 420
Index = 0
Left = 240
Picture = "frmEmploy.frx":000C
TabIndex = 0
Top = 225
Width = 1245
End
Begin VB.CommandButton cmdEdit
Caption = "保存(&S)"
Height = 435
Index = 1
Left = 240
Picture = "frmEmploy.frx":1DAB
TabIndex = 8
Top = 761
Width = 1245
End
Begin VB.CommandButton cmdEdit
Caption = "修改(&M)"
Height = 450
Index = 2
Left = 240
Picture = "frmEmploy.frx":3BAB
TabIndex = 9
Top = 1297
Width = 1245
End
Begin VB.CommandButton cmdEdit
Caption = "删除(&D)"
Height = 450
Index = 3
Left = 240
Picture = "frmEmploy.frx":598E
TabIndex = 10
Top = 1833
Width = 1245
End
Begin VB.CommandButton cmdEdit
Caption = "查询(&Q)"
Height = 450
Index = 4
Left = 240
Picture = "frmEmploy.frx":772D
TabIndex = 11
Top = 2370
Width = 1245
End
Begin VB.CommandButton cmdEdit
Height = 450
Index = 5
Left = 255
Picture = "frmEmploy.frx":94EB
Style = 1 'Graphical
TabIndex = 16
Top = 5655
Width = 1245
End
End
Begin MSFlexGridLib.MSFlexGrid msfGrid
Height = 4185
Left = 180
TabIndex = 17
Top = 2220
Width = 8415
_ExtentX = 14843
_ExtentY = 7382
_Version = 393216
FixedCols = 0
FocusRect = 2
HighLight = 0
End
Begin VB.Frame Frame1
Height = 1905
Left = 195
TabIndex = 18
Top = 60
Width = 8340
Begin VB.TextBox txtEmp
BackColor = &H00FFFFFF&
Height = 330
Index = 3
Left = 915
MaxLength = 50
TabIndex = 7
Top = 1335
Width = 7095
End
Begin VB.ComboBox cboEmp
Enabled = 0 'False
Height = 330
Index = 2
Left = 6585
Style = 2 'Dropdown List
TabIndex = 6
Top = 825
Width = 1425
End
Begin VB.ComboBox cboEmp
Enabled = 0 'False
Height = 330
Index = 1
Left = 3765
Style = 2 'Dropdown List
TabIndex = 5
Top = 825
Width = 1425
End
Begin VB.ComboBox cboEmp
Enabled = 0 'False
Height = 330
Index = 0
ItemData = "frmEmploy.frx":B35C
Left = 6585
List = "frmEmploy.frx":B366
Style = 2 'Dropdown List
TabIndex = 3
Top = 330
Width = 1425
End
Begin VB.TextBox txtEmp
Height = 330
Index = 0
Left = 915
MaxLength = 4
TabIndex = 1
Top = 330
Width = 1410
End
Begin VB.TextBox txtEmp
Height = 330
Index = 1
Left = 3765
Locked = -1 'True
MaxLength = 10
TabIndex = 2
Top = 330
Width = 1410
End
Begin VB.TextBox txtEmp
Height = 330
Index = 2
Left = 915
Locked = -1 'True
MaxLength = 3
TabIndex = 4
Top = 825
Width = 1410
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "备 注:"
Height = 210
Index = 5
Left = 210
TabIndex = 25
Top = 1395
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "工 号:"
Height = 210
Index = 0
Left = 210
TabIndex = 24
Top = 390
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "年 龄:"
Height = 210
Index = 3
Left = 210
TabIndex = 23
Top = 885
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "职 务:"
Height = 210
Index = 4
Left = 5865
TabIndex = 22
Top = 885
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "部 门:"
Height = 210
Index = 9
Left = 3037
TabIndex = 21
Top = 885
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "姓 名:"
Height = 210
Index = 1
Left = 3037
TabIndex = 20
Top = 390
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "性 别:"
Height = 210
Index = 2
Left = 5865
TabIndex = 19
Top = 390
Width = 630
End
End
Begin VB.Menu mnuEdit
Caption = "编辑"
Visible = 0 'False
Begin VB.Menu mnuEditModify
Caption = "修改(&M)"
End
Begin VB.Menu mnuEditDelete
Caption = "删除(&D)"
End
Begin VB.Menu mnuEditBar1
Caption = "-"
End
Begin VB.Menu mnuEditCard
Caption = "发新卡"
Index = 0
End
Begin VB.Menu mnuEditCard
Caption = "卡挂失"
Index = 1
End
Begin VB.Menu mnuEditCard
Caption = "取消挂失"
Index = 2
End
Begin VB.Menu mnuEditCard
Caption = "更换卡"
Index = 3
Visible = 0 'False
End
End
End
Attribute VB_Name = "frmEmploy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mblnIsModify As Boolean
Dim mblnIsAdd As Boolean
Dim mintModLine As Integer
Public mcolWorkno As Collection
Dim mblnIsToCloseColor As Boolean
Dim mblnIsNeedSave As Boolean
Const mstrNoCard = "-"
Const mstrHasCard = "√"
Const mstrMissCard = "○"
'***** cmdCard
Private Const mNew = 0
Private Const mMiss = 1
Private Const mCancelMiss = 2
Private Const mChange = 3
Private Const mGreyCard = 4
'***txtEmp
Const mWorkNo = 0
Const mName = 1
Const mAge = 2
Const mNote = 3
'*****cboEmp
Const mSex = 0
Const mDept = 1
Const mTitle = 2
'****msfGrid
Const mGridWorkNo = 1
Const mGridSex = 3
Const mDeptName = 5
Const mTitleName = 6
Const mCardStatus = 7
Const mMsg1 = "您确定要删除此名员工的信息?"
Const mMsg2 = "抱歉,删除不成功!"
Private Sub RefreshCard(RefObj As Object, intCardStatus As Integer)
Dim i As Integer
Select Case intCardStatus
Case gNoCard
For i = 0 To RefObj.Count - 1
With RefObj(i)
If i = mNew Then
If Not .Enabled Then .Enabled = True
Else
If .Enabled Then .Enabled = False
End If
End With
Next
Case gHasCard
For i = 0 To RefObj.Count - 1
With RefObj(i)
If i = mMiss Or i = mChange Then
If Not .Enabled Then .Enabled = True
Else
If .Enabled Then .Enabled = False
End If
End With
Next
Case gMissCard
For i = 0 To RefObj.Count - 1
With RefObj(i)
If i = mCancelMiss Or i = mChange Then
If Not .Enabled Then .Enabled = True
Else
If .Enabled Then .Enabled = False
End If
End With
Next
Case mGreyCard
For i = 0 To RefObj.Count - 1
If RefObj(i).Enabled Then RefObj(i).Enabled = False
Next
End Select
End Sub
Private Sub cboEmp_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
SendKeyTab KeyCode
End If
End Sub
Private Sub cmdCard_Click(Index As Integer)
Dim intStatus As Integer
Select Case Index
Case mNew
intStatus = gHasCard
Case mMiss
intStatus = gMissCard
Case mCancelMiss
intStatus = gHasCard
End Select
Dim Rst As Recordset
Dim strWorkNo As String
strWorkNo = Trim(msfGrid.TextMatrix(msfGrid.row, mGridWorkNo))
Set Rst = gDataBase.OpenRecordset("select CardStatus from Employee where " _
& " WorkNo='" & strWorkNo & "'")
On Error GoTo CardErr
If Rst.RecordCount > 0 Then
With Rst
.Edit
!CardStatus = intStatus
.Update
End With
End If
Rst.Close
Set Rst = Nothing
chgGridStatus intStatus
RefreshCard cmdCard, intStatus
Exit Sub
CardErr:
Err.Clear
MsgBox "更改未成功!,请检查相关信息后重试!", vbInformation, gTitle
End Sub
Private Sub chgGridStatus(intStatus As Integer)
With msfGrid
.TextMatrix(.row, mCardStatus) = Trim(getStatus(intStatus))
.TextMatrix(.row, .Cols - 1) = intStatus
End With
End Sub
Private Sub cmdCloseColor_Click()
CloseColor msfGrid
mblnIsToCloseColor = False
ChgcmdCloseColor
End Sub
Public Sub cmdEdit_Click(Index As Integer)
Dim strTmp As String
Select Case Index
Case gCMDAPPEND
Dim blnIsToGo As Boolean
blnIsToGo = True
If Not mblnIsAdd Then
strTmp = gSTRCANCEL
AddAction
InitxtEmp
txtEmp(mWorkNo).SetFocus
Else
If mblnIsNeedSave Then
If MsgBox("您确定不保存吗?", vbQuestion + _
vbYesNo + vbDefaultButton2, gTitle) _
= vbNo Then
blnIsToGo = False
End If
End If
If blnIsToGo Then
strTmp = gSTRAPPEND
InitxtEmp
ChangeColor False
mblnIsNeedSave = False
RefreshButton cmdEdit, gCMDEDITCANCEL
Else
strTmp = gSTRCANCEL
End If
End If
strTmp = strTmp & "(&A)"
cmdEdit(gCMDAPPEND).Caption = strTmp
If blnIsToGo Then
mblnIsAdd = Not mblnIsAdd
End If
Case gCMDSAVE
If AddToDataBase Then
AfterSave
strTmp = gSTRMODIFY & "&M"
cmdEdit(gCMDEDIT).Caption = strTmp
mnuEditModify.Caption = strTmp
End If
Case gCMDEDIT
If Not mblnIsModify Then
strTmp = gSTRRESET
ToModify
Else
strTmp = gSTRMODIFY
AfterSave
End If
strTmp = strTmp & "(&M)"
mnuEditModify.Caption = strTmp
cmdEdit(gCMDEDIT).Caption = strTmp
Case gCMDDELETE
MsgBox "您如果删除了该员工," & vbCrLf & vbCrLf _
& "则有关该员工所有信息都将删除" & vbCrLf & vbCrLf _
& "包括考勤记录、请假记录,出差记录等...", vbCritical, gTitle
' DeleteForEmployee msfGrid, 1, "您确定要删除此名员工的信息?", _
' gDataBase, "Employee", "WorkNo"
If DeleteForEmployee Then
If Not txtEmp(mName).Locked Then InitxtEmp
RefreshButton cmdEdit, gCMDEDITNORMAL
End If
Case gCMDQUERY
Set mcolWorkno = New Collection
frmEmpFind.Show vbModal
If mblnIsToCloseColor Then
mblnIsToCloseColor = False
CloseColor msfGrid
ChgcmdCloseColor
End If
If mcolWorkno.Count > 0 Then ShowQueryMan
Case gCMDRETURN
Unload Me
End Select
End Sub '
Private Function DeleteForEmployee() As Boolean
Dim isTrans As Boolean
Dim strKey As String
Dim strField As String
If MsgBox(mMsg1, _
vbQuestion + vbYesNo + vbDefaultButton2, _
gTitle) = vbNo Then Exit Function
On Error GoTo DeleteErr
With msfGrid
strKey = Trim(.TextMatrix(.row, 1))
strField = "WorkNo"
BeginTrans
isTrans = True
SetDelFlagForTable strKey, gDataBase, gPlanTableName, strField, True
SetDelFlagForTable strKey, gDataBase, "Absent", strField, True
SetDelFlagForTable strKey, gDataBase, "ChangePlan", strField, True
SetDelFlagForTable strKey, gDataBase, "KqHistory", strField, True
SetDelFlagForTable strKey, gDataBase, "Leave", strField, True
SetDelFlagForTable strKey, gDataBase, "Employee", strField, True
CommitTrans
DeleteForEmployee = True
isTrans = False
If .Rows = .FixedRows + 1 Then
.Rows = .FixedRows
Else
.RemoveItem .row
End If
End With
Exit Function
DeleteErr:
If isTrans Then Rollback
MsgBox mMsg2 & vbCrLf & vbCrLf & Err.Description, vbExclamation, gTitle
Err.Clear
DeleteForEmployee = False
End Function
Private Sub ShowQueryMan()
Dim i As Integer
Dim j As Integer
Dim H As Integer
With msfGrid
If .Redraw Then .Redraw = False
mblnIsToCloseColor = True
ChgcmdCloseColor
For i = 1 To mcolWorkno.Count
For j = .FixedRows To .Rows - 1
If Trim(mcolWorkno.Item(i)) = Trim(.TextMatrix(j, mGridWorkNo)) Then
For H = 0 To .Cols - 1
.row = j
.col = H
.CellBackColor = gCellSelBackColor
.CellForeColor = gCellSelForeColor
Next
Exit For
End If
Next
Next
.Redraw = True
End With
End Sub
Private Sub AfterSave()
InitxtEmp
ChangeColor False
RefreshButton cmdEdit, gCMDEDITNORMAL
mblnIsModify = False
mblnIsAdd = False
mblnIsNeedSave = False
cmdEdit(gCMDAPPEND).Caption = gSTRAPPEND & "&A"
End Sub
Private Sub InitxtEmp()
Dim i As Integer
For i = 0 To txtEmp.Count - 1
With txtEmp(i)
.Text = Empty
End With
Next
For i = 0 To cboEmp.Count - 1
If cboEmp(i).ListCount > 0 Then cboEmp(i).ListIndex = 0
Next
End Sub
Private Sub AddAction()
RefreshButton cmdEdit, gCMDAPPEND
ChangeColor True
End Sub
Private Sub Form_Load()
SetGridColor msfGrid
ChangeColor False
RefreshButton cmdEdit, gCMDEDITNORMAL
RefreshCard cmdCard, mGreyCard
msfGrid.FormatString = "^序号" & vbTab & "^工号" & Space(2) & vbTab _
& "<姓 名" & Space(3) & vbTab _
& "^性别" & Space(1) & vbTab _
& "^年龄" & Space(1) & vbTab _
& "<部 门" & Space(4) & vbTab _
& "<职 务" & Space(4) & vbTab _
& "^卡状态" & Space(3) & vbTab _
& "<备 注" & Space(7) & vbTab & " mGridSex Then
If i = mGridSex + 1 Then
txtEmp(i - 2) = CellStr
Else
txtEmp(i - 1) = CellStr
End If
Else
LookForCboByStr cboEmp(mSex), CellStr
End If
Case mDeptName
LookForCboByStr cboEmp(mDept), CellStr
Case mTitleName
LookForCboByStr cboEmp(mTitle), CellStr
End Select
Next
txtEmp(mNote) = Trim(.TextMatrix(mintModLine, .Cols - 2))
End With
ChangeColor True
RefreshButton cmdEdit, gCMDEDIT
txtEmp(mWorkNo).Locked = True
txtEmp(mName).SetFocus
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmEmploy = Nothing
End Sub
Private Sub mnuEditCard_Click(Index As Integer)
cmdCard_Click Index
End Sub
Private Sub mnuEditDelete_Click()
cmdEdit_Click gCMDDELETE
End Sub
Private Sub mnuEditModify_Click()
cmdEdit_Click gCMDEDIT
End Sub
Private Sub msfGrid_Click()
With msfGrid
If .MouseRow = 0 Then SortGridByCol msfGrid
RefreshCard cmdCard, Val(.TextMatrix(.row, .Cols - 1))
End With
End Sub
Private Sub RefreshBtnLocal(blnIsGotFocus As Boolean)
cmdEdit(gCMDEDIT).Enabled = blnIsGotFocus
cmdEdit(gCMDDELETE).Enabled = blnIsGotFocus
End Sub
Private Sub msfGrid_GotFocus()
If msfGrid.Rows <= msfGrid.FixedRows Then Exit Sub
If Not (mblnIsModify Or mblnIsAdd) Then
RefreshBtnLocal True
End If
End Sub
'Private Sub msfGrid_LostFocus()
' If Not mblnIsModify Then
' RefreshBtnLocal False
' End If
'End Sub
Private Sub msfGrid_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
With msfGrid
If .MouseRow = 0 Then Exit Sub
If .Rows <= .FixedRows Then Exit Sub
If Button = 2 Then
If Trim(.TextMatrix(.MouseRow, mGridWorkNo)) <> Empty Then
RefreshCard mnuEditCard, Val(.TextMatrix(.row, .Cols - 1))
PopupMenu mnuEdit
End If
End If
End With
End Sub
Private Sub txtEmp_Change(Index As Integer)
If Index = mWorkNo Then
If Not txtEmp(Index).Locked Then
mblnIsNeedSave = Trim(txtEmp(Index)) <> Empty
End If
End If
End Sub
Private Sub txtEmp_GotFocus(Index As Integer)
GotFocus txtEmp(Index)
End Sub
Private Sub txtEmp_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
SendKeyTab KeyCode
End If
End Sub
Private Sub FillGrid()
Dim Rst As Recordset
Dim ClipStr As String
Dim tmpStr As String
Dim intCount As Integer
Set Rst = gDataBase.OpenRecordset("QryEmployee", dbOpenSnapshot)
If msfGrid.Redraw Then msfGrid.Redraw = False
With Rst
While Not .EOF
intCount = intCount + 1
ClipStr = ClipStr & CStr(intCount) & vbTab _
& IIf(IsNull(!WorkNo), "", Trim(!WorkNo)) & vbTab _
& IIf(IsNull(!Name), "", Trim(!Name)) & vbTab _
& IIf(IsNull(!Sex), "", Trim(!Sex)) & vbTab _
& IIf(IsNull(!Age), "", Trim(Str(!Age))) & vbTab _
& IIf(IsNull(!DeptName), "", Trim(!DeptName)) & vbTab _
& IIf(IsNull(!TitleName), "", Trim(!TitleName)) & vbTab
tmpStr = getStatus(!CardStatus)
ClipStr = ClipStr & tmpStr & vbTab _
& IIf(IsNull(!Note), "", Trim(!Note)) _
& vbTab & !CardStatus
If Not .EOF Then
ClipStr = ClipStr & vbCr
End If
.MoveNext
Wend
End With
Dim intRows As Integer
Dim intCols As Integer
intRows = Rst.RecordCount + 1
intCols = 10
ClipToGrid msfGrid, ClipStr, intRows, intCols
msfGrid.ColWidth(msfGrid.Cols - 1) = 0
Rst.Close
Set Rst = Nothing
End Sub
Private Function getStatus(intStatus As Integer) As String
Dim tmpStr As String
Select Case intStatus
Case gNoCard
tmpStr = mstrNoCard
Case gHasCard
tmpStr = mstrHasCard
Case gMissCard
tmpStr = mstrMissCard
End Select
getStatus = tmpStr
End Function
Private Function AddToDataBase() As Boolean
Dim strWorkNo As String
Dim strName As String
Dim strSex As String
Dim strAge As String
Dim intDept As Integer
Dim intTitle As Integer
Dim strNote As String
Dim isTrans As Boolean
strWorkNo = Trim(txtEmp(mWorkNo))
strName = Trim(txtEmp(mName))
strSex = Trim(cboEmp(mSex).Text)
strAge = Trim(txtEmp(mAge))
strNote = Trim(txtEmp(mNote))
getItemData cboEmp(mDept), intDept
getItemData cboEmp(mTitle), intTitle
If strWorkNo = Empty Then
MsgBox "工号不能为空,请输入!!", , gTitle
AddToDataBase = False
txtEmp(mWorkNo).SetFocus
Exit Function
End If
If strName = Empty Then
MsgBox "姓名不能为空,请输入!!", vbInformation, gTitle
AddToDataBase = False
txtEmp(mName).SetFocus
Exit Function
End If
If Not mblnIsModify Then
If IsExist(gDataBase, "Employee", "WorkNo", strWorkNo, True) Then
MsgBox "该工号已经存在!,请更换!!", vbInformation, gTitle
AddToDataBase = False
txtEmp(mWorkNo).SetFocus
Exit Function
End If
End If
Dim Rst As Recordset
If Not mblnIsModify Then
Set Rst = gDataBase.OpenRecordset("Employee")
Else
Set Rst = gDataBase.OpenRecordset("select * from Employee " _
& " where WorkNo='" & strWorkNo & "'")
If Rst.RecordCount <= 0 Then GoTo SaveErr
End If
On Error GoTo SaveErr
BeginTrans
isTrans = True
If mblnIsModify Then
Rst.Edit
Else
Rst.AddNew
Rst!WorkNo = strWorkNo
End If
With Rst
!Name = strName
!Sex = strSex
!Age = CInt(strAge)
!DeptID = intDept
!TitleID = intTitle
!Note = strNote
If Not mblnIsModify Then
!CardStatus = gNoCard
End If
!Spell = UCase(GetPy2(strName))
.Update
End With
If Not mblnIsModify Then
Dim intDay As Integer
Dim bytDay As Byte
Dim bytShift As Byte
Dim Sql As String
'在排班表中插入此员工
' bytShift = gNOSHIFT
' For intDay = 1 To gMaxDay
' bytDay = intDay
' Sql = "Insert into " & gPlanTableName & _
' " (WorkNo,F_Day,F_Shift) values ('" _
' & strWorkNo & "'," & bytDay & "," & bytShift & ")"
' gDataBase.Execute Sql
' Next
End If
CommitTrans
isTrans = False
Rst.Close
Set Rst = Nothing
AddToDataBase = True
With msfGrid
If Not mblnIsModify Then
Dim StrAdd As String
Dim intOrder As Integer
If .Rows <= .FixedRows Then
intOrder = 0
Else
intOrder = CInt(.TextMatrix(.Rows - 1, 0))
End If
StrAdd = CStr(intOrder + 1) & vbTab _
& strWorkNo & vbTab _
& strName & vbTab _
& strSex & vbTab _
& strAge & vbTab _
& Trim(cboEmp(mDept).Text) & vbTab _
& Trim(cboEmp(mTitle).Text) & vbTab _
& mstrNoCard & vbTab _
& strNote
.AddItem StrAdd
.TopRow = .Rows - 1
Else
Dim intRow As Integer
intRow = .row
.TextMatrix(intRow, 2) = strName
.TextMatrix(intRow, 3) = strSex
.TextMatrix(intRow, 4) = strAge
.TextMatrix(intRow, 5) = Trim(cboEmp(mDept).Text)
.TextMatrix(intRow, 6) = Trim(cboEmp(mTitle).Text)
.TextMatrix(intRow, 8) = strNote
End If
End With
Exit Function
SaveErr:
If isTrans Then Rollback
MsgBox "数据未保存成功!请再试!!" & vbCrLf & vbCrLf & Err.Description, , gTitle
Err.Clear
AddToDataBase = False
' Rst.CancelUpdate
End Function
Private Sub txtEmp_KeyPress(Index As Integer, KeyAscii As Integer)
Select Case Index
Case mWorkNo
KeyAscii = KeyFilter(KeyAscii, False)
Case mAge
KeyAscii = ValiText(KeyAscii, "0123456789", True)
End Select
End Sub
Private Sub txtEmp_LostFocus(Index As Integer)
If Index = mWorkNo Then
txtEmp(Index) = UCase(Trim(txtEmp(Index)))
End If
End Sub