人事管理系统ER图+流程图+开题报告+源代码+数据流图 第14页
End Sub
Private Sub cmdOK_Click()
If Txt(0).Text = "" Then
MsgBox "不可以为空"
Txt(0).SetFocus
Exit Sub
End If
Bupdata = False
DataA.Recordset.Edit
If FrmMain.cutable = "leave" Then
DataA.Recordset.Fields(8) = frmLogin.EmploID
DataA.Recordset.Fields(9) = Now
ElseIf FrmMain.cutable = "employee" Then
DataA.Recordset.Fields(13) = frmLogin.EmploID
DataA.Recordset.Fields(14) = Now
If Opsex(0) Then
DataA.Recordset.Fields(4) = "男"
Else
DataA.Recordset.Fields(4) = "女"
End If
DataA.Recordset.Fields(7) = Cmbdegree.Text
DataA.Recordset.Fields(8) = Cmbdepart.Text
DataA.Recordset.Fields(13) = frmLogin.EmploID
DataA.Recordset.Fields(14) = Now
Else
For i = 4 To 10
If Not IsNumeric(Txt(i).Text) Then
MsgBox "not a number"
Txt(i).SetFocus
Exit Sub
End If
Next i
DataA.Recordset.Fields(13) = frmLogin.EmploID
DataA.Recordset.Fields(14) = Now
End If
For i = 1 To 12
If Txt(i).Text = "" Then Txt(i).Text = 0 'DataA.Recordset.Fields(i) = 0
Next i
DataA.Recordset.Update
FrmMain.DataA.Refresh
DataB.Refresh
End Sub
Private Sub DataA_Validate(Action As Integer, Save As Integer)
If Action = 11 And Bupdata Then
Save = 0
End If
End Sub
Private Sub Lab_Click(Index As Integer)
End Sub
Private Sub Txt_KeyPress(Index As Integer, KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack And Index = 0 Then
KeyAscii = 0
Exit Sub
End If
If FrmMain.cutable = "leave" And Index = 1 Then
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack Then
KeyAscii = 0
Exit Sub
End If
End If
If FrmMain.cutable = "salary" Then
If Index <= 3 Then
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack Then
KeyAscii = 0
Exit Sub
End If
End If
If Index = 13 Then Exit Sub
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> vbKeyBack And KeyAscii <> 46 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub Txt_change(Index As Integer)
If Bupdata = False Then Bupdata = True
If FrmMain.cutable = "salary" Then
If Txt(Index).Text = "" Then Exit Sub
If Index >= 4 And Index <= 6 Then
Txt(7).Text = Val(Txt(4).Text) + Val(Txt(5).Text) + Val(Txt(6).Text)
Txt(12).Text = Val(Txt(7).Text) - Val(Txt(11).Text)
End If
If Index >= 8 And Index <= 10 Then
Txt(11).Text = Val(Txt(8).Text) + Val(Txt(9).Text) + Val(Txt(10).Text)
Txt(12).Text = Val(Txt(7).Text) - Val(Txt(11).Text)
End If
End If
End Sub
Private Sub Form_Load()
DataA.DatabaseName = App.Path + "\sm.mdb"
DataB.DatabaseName = App.Path + "\sm.mdb"
DataA.Caption = FrmMain.cutable
DataA.RecordSource = "select * from " + FrmMain.cutable
DataB.RecordSource = "select * from " + FrmMain.cutable
DataA.Refresh
Txt(0).Locked = True
'If FrmMain.DBGA.Row = 0 Then Exit Sub
If FrmMain.cutable = "employee" Then 'employee
For i = 0 To 12
Lab(i).Caption = DataA.Recordset.Fields(i).Name
Next i
Txt(0).DataField = DataA.Recordset.Fields(0).Name
Txt(1).DataField = DataA.Recordset.Fields(1).Name
Txt(2).DataField = DataA.Recordset.Fields(2).Name
Txt(3).DataField = DataA.Recordset.Fields(3).Name
Txt(4).Visible = False
Txt(5).DataField = DataA.Recordset.Fields(5).Name
Txt(6).DataField = DataA.Recordset.Fields(6).Name
Txt(7).Visible = False
Txt(8).Visible = False
Txt(9).DataField = DataA.Recordset.Fields(9).Name
Txt(10).DataField = DataA.Recordset.Fields(10).Name
Txt(11).DataField = DataA.Recordset.Fields(11).Name
Txt(12).DataField = DataA.Recordset.Fields(12).Name
Txt(13).DataField = DataA.Recordset.Fields(15).Name
If FrmMain.cuAp > -1 Then