📄 frm_addotherkq.frm
字号:
Unload Me
End Sub
Private Sub Cmd_OK_Click()
''''''定义临时(或称局部变量)'''''''
Dim strSql As String
Dim m_Rs As New ADODB.Recordset
''''''输入正确性的检测'''''''''''''''
If Combo1.Text = "" Then
MsgBox "职工编号不能为空,请输入职工编号...", vbOKOnly + vbExclamation, "警告!"
Exit Sub
End If
If iTableType = 1 Then
If iOLFlag = 0 Then
If MsgBox("确定是否存盘?", vbYesNo + vbQuestion, "存盘?") = vbYes Then
'''''''首先存盘请假信息表(LeaveInfo)'''''''''''
strSql = "INSERT INTO LeaveInfo(LStuffID,LFromDay,LIll,LPrivate) Values('" & Trim(Combo1.Text) & "','"
strSql = strSql & Trim(BeginDate.Text) & "'," & Val(Trim(Text1.Text)) & "," & Val(Trim(Text2.Text)) & ")"
'''MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
''''''继续存盘加班信息表(OverTimeInfo)''''''''''''''
strSql = "INSERT INTO OverTimeInfo(OStuffID,OFromDay,OSll,OSpeciality) Values('" & Trim(Combo1.Text) & "','"
strSql = strSql & Trim(OverDate.Text) & "'," & Val(Trim(Text4.Text)) & "," & Val(Trim(Text3.Text)) & ")"
'''MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
''''''存盘出差信息表(ErrandInfo)'''''''''''''''''
strSql = "INSERT INTO ErrandInfo(EStuffID,EFromDay,EErrandDays,EPurpose) Values('" & Trim(Combo1.Text) & "','"
strSql = strSql & Trim(ErrandDate.Text) & "'," & Val(Trim(Text5.Text)) & "," & Val(Trim(Text6.Text)) & ")"
'''MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "其他考勤信息存盘成功..."
''''''初始化控件''''''''''''''''''''''''''''''
BeginDate.Text = Format(Now, "yyyy年mm月dd日")
'OverDate.Text = Format(Now, "yyyy年mm月dd日")
'ErrandDate.Text = Format(Now, "yyyy年mm月dd日")
Text1.Text = "0"
Text2.Text = "0"
''Text3.Text = "0"
'Text4.Text = "0"
'Text5.Text = "0"
'Text6.Text = ""
End If
End If ''''iOLFlag=0
''''''''修改请假信息'''''''''''''
If iOLFlag = 1 Then
If MsgBox("确定是否修改请假信息?", vbYesNo + vbQuestion, "修改?") = vbYes Then
strSql = "UPDATE LeaveInfo SET LIll=" & Val(Trim(Text1.Text)) & ",LPrivate=" & Trim(Text2.Text) & ",LFromDay='" & Trim(BeginDate.Text) & "' Where LStuffID='" & Trim(Combo1.Text) & "'"
'MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "修改请假信息成功..."
End If
End If
'''''''删除请假信息''''''''''''''''''
If iOLFlag = 2 Then
If MsgBox("确定是否删除请假信息?", vbYesNo + vbQuestion, "删除?") = vbYes Then
strSql = "DELETE * FROM LeaveInfo WHERE LStuffID='" & Trim(sOLData(0)) & "'"
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "删除请假信息成功..."
BeginDate.Text = Format(Now, "yyyy年mm月dd日")
'OverDate.Text = Format(Now, "yyyy年mm月dd日")
'ErrandDate.Text = Format(Now, "yyyy年mm月dd日")
Text1.Text = "0"
Text2.Text = "0"
End If
End If
End If '''''if iTableType=1
'''''''对加班信息表操作'''''''''''''''''''
If iTableType = 2 Then
If iOOFlag = 0 Then
If MsgBox("确定是否存盘?", vbYesNo + vbQuestion, "存盘?") = vbYes Then
'''''''首先存盘请假信息表(LeaveInfo)'''''''''''
strSql = "INSERT INTO LeaveInfo(LStuffID,LFromDay,LIll,LPrivate) Values('" & Trim(Combo1.Text) & "','"
strSql = strSql & Trim(BeginDate.Text) & "'," & Val(Trim(Text1.Text)) & "," & Val(Trim(Text2.Text)) & ")"
'''MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
''''''继续存盘加班信息表(OverTimeInfo)''''''''''''''
strSql = "INSERT INTO OverTimeInfo(OStuffID,OFromDay,OSll,OSpeciality) Values('" & Trim(Combo1.Text) & "','"
strSql = strSql & Trim(OverDate.Text) & "'," & Val(Trim(Text4.Text)) & "," & Val(Trim(Text3.Text)) & ")"
'''MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
''''''存盘出差信息表(ErrandInfo)'''''''''''''''''
strSql = "INSERT INTO ErrandInfo(EStuffID,EFromDay,EErrandDays,EPurpose) Values('" & Trim(Combo1.Text) & "','"
strSql = strSql & Trim(ErrandDate.Text) & "'," & Val(Trim(Text5.Text)) & "," & Val(Trim(Text6.Text)) & ")"
'''MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "其他考勤信息存盘成功..."
''''''初始化控件''''''''''''''''''''''''''''''
'BeginDate.Text = Format(Now, "yyyy年mm月dd日")
OverDate.Text = Format(Now, "yyyy年mm月dd日")
'ErrandDate.Text = Format(Now, "yyyy年mm月dd日")
'Text1.Text = "0"
'Text2.Text = "0"
Text3.Text = "0"
Text4.Text = "0"
'Text5.Text = "0"
'Text6.Text = ""
End If
End If ''''iOLFlag=0
''''''''修改请假信息'''''''''''''
If iOOFlag = 1 Then
If MsgBox("确定是否修改加班信息?", vbYesNo + vbQuestion, "修改?") = vbYes Then
strSql = "UPDATE OverTimeInfo SET OSll=" & Val(Trim(Text4.Text)) & ",OSpeciality=" & Trim(Text3.Text) & ",OFromDay='" & Trim(OverDate.Text) & "' Where OStuffID='" & Trim(Combo1.Text) & "'"
'MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "修改加班信息成功..."
End If
End If
'''''''删除加班信息''''''''''''''''''
If iOOFlag = 2 Then
If MsgBox("确定是否删除加班信息?", vbYesNo + vbQuestion, "删除?") = vbYes Then
strSql = "DELETE * FROM OverTimeInfo WHERE OStuffID='" & Trim(sOOData(0)) & "'"
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "删除加班信息成功..."
OverDate.Text = Format(Now, "yyyy年mm月dd日")
Text3.Text = "0"
Text4.Text = "0"
End If
End If
End If '''''if iTableType=2
''''''对出差信息表单操作'''''''''''''''''''''''''''
If iTableType = 3 Then
If iOEFlag = 0 Then
If MsgBox("确定是否存盘?", vbYesNo + vbQuestion, "存盘?") = vbYes Then
'''''''首先存盘请假信息表(LeaveInfo)'''''''''''
strSql = "INSERT INTO LeaveInfo(LStuffID,LFromDay,LIll,LPrivate) Values('" & Trim(Combo1.Text) & "','"
strSql = strSql & Trim(BeginDate.Text) & "'," & Val(Trim(Text1.Text)) & "," & Val(Trim(Text2.Text)) & ")"
'''MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
''''''继续存盘加班信息表(OverTimeInfo)''''''''''''''
strSql = "INSERT INTO OverTimeInfo(OStuffID,OFromDay,OSll,OSpeciality) Values('" & Trim(Combo1.Text) & "','"
strSql = strSql & Trim(OverDate.Text) & "'," & Val(Trim(Text4.Text)) & "," & Val(Trim(Text3.Text)) & ")"
'''MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
''''''存盘出差信息表(ErrandInfo)'''''''''''''''''
strSql = "INSERT INTO ErrandInfo(EStuffID,EFromDay,EErrandDays,EPurpose) Values('" & Trim(Combo1.Text) & "','"
strSql = strSql & Trim(ErrandDate.Text) & "'," & Val(Trim(Text5.Text)) & "," & Val(Trim(Text6.Text)) & ")"
'''MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "其他考勤信息存盘成功..."
''''''初始化控件''''''''''''''''''''''''''''''
'BeginDate.Text = Format(Now, "yyyy年mm月dd日")
ErrandDate.Text = Format(Now, "yyyy年mm月dd日")
Text5.Text = "0"
Text6.Text = ""
End If
End If ''''iOLFlag=0
''''''''修改出差信息'''''''''''''
If iOEFlag = 1 Then
If MsgBox("确定是否修改出差信息?", vbYesNo + vbQuestion, "修改?") = vbYes Then
strSql = "UPDATE ErrandInfo SET EErrandDays=" & Val(Trim(Text5.Text)) & ",EPurpose='" & Trim(Text6.Text) & "',EFromDay='" & Trim(ErrandDate.Text) & "' Where EStuffID='" & Trim(Combo1.Text) & "'"
'MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "修改出差信息成功..."
End If
End If
'''''''删除请假信息''''''''''''''''''
If iOEFlag = 2 Then
If MsgBox("确定是否删除出差信息?", vbYesNo + vbQuestion, "删除?") = vbYes Then
strSql = "DELETE * FROM ErrandInfo WHERE EStuffID='" & Trim(sOEData(0)) & "'"
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "删除出差信息成功..."
ErrandDate.Text = Format(Now, "yyyy年mm月dd日")
Text5.Text = "0"
Text6.Text = ""
End If
End If
End If '''''if iTableType=2
End Sub
Private Sub Form_Load()
'''''添加控件信息'''''''''
Dim strSql As String
''''**SID为职工编号的字段名'''''''
''''**SDept为职工所在的部门名称字段名'''''''''
''''**StuffInfo为人事基本信息的表名'''''''''''
''''**Person.mdb为数据库名称''''''''''''''''''
''''**BindToCombo为公共模块的函数在模块AdoConn中
strSql = "SELECT * FROM StuffInfo Order By SID"
BindToCombo strSql, "Person.mdb", "SID", Combo1
''''初始化其他控件'''''''''''''''''''''''
'''''''对请假信息表单操作'''''''''''
If iTableType = 1 Then
SSTab1.Tab = 0
If iOLFlag = 0 Then
BeginDate.Text = Format(Now, "yyyy年mm月dd日")
'OverDate.Text = Format(Now, "yyyy年mm月dd日")
'ErrandDate.Text = Format(Now, "yyyy年mm月dd日")
Text1.Text = "0"
Text2.Text = "0"
'Text3.Text = "0"
'Text4.Text = "0"
'Text5.Text = "0"
'Text6.Text = ""
End If
If iOLFlag = 1 Then
Combo1.Text = Trim(sOLData(0))
BeginDate.Text = Trim(sOLData(1))
Text1.Text = Trim(sOLData(2))
Text2.Text = Trim(sOLData(3))
End If
If iOLFlag = 2 Then
Combo1.Text = Trim(sOLData(0))
BeginDate.Text = Trim(sOLData(1))
Text1.Text = Trim(sOLData(2))
Text2.Text = Trim(sOLData(3))
End If
End If
'''''''对加班信息表操作''''''''''''''''''''''''
If iTableType = 2 Then
SSTab1.Tab = 1
If iOOFlag = 0 Then
OverDate.Text = Format(Now, "yyyy年mm月dd日")
'OverDate.Text = Format(Now, "yyyy年mm月dd日")
'ErrandDate.Text = Format(Now, "yyyy年mm月dd日")
Text3.Text = "0"
Text4.Text = "0"
'Text3.Text = "0"
'Text4.Text = "0"
'Text5.Text = "0"
'Text6.Text = ""
End If
If iOOFlag = 1 Then
Combo1.Text = Trim(sOOData(0))
OverDate.Text = Trim(sOOData(1))
Text4.Text = Trim(sOOData(2))
Text3.Text = Trim(sOOData(3))
End If
If iOOFlag = 2 Then
Combo1.Text = Trim(sOOData(0))
OverDate.Text = Trim(sOOData(1))
Text4.Text = Trim(sOOData(2))
Text3.Text = Trim(sOOData(3))
End If
End If
'''''''对出差信息表操作''''''''''''''''''''''''''
If iTableType = 3 Then
SSTab1.Tab = 2
If iOEFlag = 0 Then
ErrandDate.Text = Format(Now, "yyyy年mm月dd日")
'OverDate.Text = Format(Now, "yyyy年mm月dd日")
'ErrandDate.Text = Format(Now, "yyyy年mm月dd日")
Text5.Text = "0"
Text6.Text = ""
'Text3.Text = "0"
'Text4.Text = "0"
'Text5.Text = "0"
'Text6.Text = ""
End If
If iOEFlag = 1 Then
Combo1.Text = Trim(sOEData(0))
ErrandDate.Text = Trim(sOEData(1))
Text5.Text = Trim(sOEData(2))
Text6.Text = Trim(sOEData(3))
End If
If iOEFlag = 2 Then
Combo1.Text = Trim(sOEData(0))
ErrandDate.Text = Trim(sOEData(1))
Text5.Text = Trim(sOEData(2))
Text6.Text = Trim(sOEData(3))
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -