关于VB的一些问题 5
'******************************************************************************Privat...
' ******************************************************************************
Private Sub updatetbOffWork()
Dim strSQL As String
Dim rstWork As ADODB.Recordset
Dim result As Boolean
Dim intWorkHour As Integer
strSQL = "select * from tbOnWork where EmpId='" + Trim(gUserName) + "' and DateWork='" + StrDate + "'"
result = ExecuteSQL(strSQL, rstWork, False)
If rstWork.RecordCount = 0 Then
MsgBox "您今天没有出勤记录!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Else
Me.lblName.Visible = True
Me.lblTextOn.Visible = True
Me.lblOnTime.Visible = True
Me.lblTextHour.Visible = True
Me.lblHour.Visible = True
Me.lblTextOff.Visible = True
Me.lblOffTime.Visible = True
Me.lblName.Caption = gUserName
If rstWork.Fields("Flag") = "已确认" Then
MsgBox "出勤信息已经被确认,退勤时间不能修改!", vbOKOnly + vbExclamation, "警告"
If Not IsNull(rstWork.Fields("OnWorkFrom")) Then
Me.lblOnTime.Caption = Mid(CStr(rstWork.Fields("OnWorkFrom")), 11)
End If
If Not IsNull(rstWork.Fields("OnWorkTo")) Then
Me.lblOffTime.Caption = Mid(CStr(rstWork.Fields("OnWorkTo")), 11)
End If
If (Not IsNull(rstWork.Fields("OnWorkTo"))) And _
(Not IsNull(rstWork.Fields("OnWorkFrom"))) Then
intWorkHour = DateDiff("h", rstWork.Fields("OnWorkFrom"), rstWork.Fields("OnWorkTo"))
Me.lblHour.Caption = intWorkHour
End If
Exit Sub
Else
intWorkHour = DateDiff("h", rstWork.Fields("OnWorkFrom"), Now)
Me.lblOnTime.Caption = Mid(CStr(rstWork.Fields("OnWorkFrom")), 11)
Me.lblOffTime.Caption = Time
Me.lblHour.Caption = intWorkHour
strSQL = "update tbOnWork set OnWorkTo='" + CStr(Now) + "', WorkHour='" + CStr(intWorkHour)
strSQL = strSQL + "' where EmpId='" + Trim(gUserName) + "' and DateWork='" + StrDate + "'"
result = ExecuteSQL(strSQL, rstWork, True)
End If
End If
End Sub
大概的意思是什么,语句是什么? 展开
Private Sub updatetbOffWork()
Dim strSQL As String
Dim rstWork As ADODB.Recordset
Dim result As Boolean
Dim intWorkHour As Integer
strSQL = "select * from tbOnWork where EmpId='" + Trim(gUserName) + "' and DateWork='" + StrDate + "'"
result = ExecuteSQL(strSQL, rstWork, False)
If rstWork.RecordCount = 0 Then
MsgBox "您今天没有出勤记录!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Else
Me.lblName.Visible = True
Me.lblTextOn.Visible = True
Me.lblOnTime.Visible = True
Me.lblTextHour.Visible = True
Me.lblHour.Visible = True
Me.lblTextOff.Visible = True
Me.lblOffTime.Visible = True
Me.lblName.Caption = gUserName
If rstWork.Fields("Flag") = "已确认" Then
MsgBox "出勤信息已经被确认,退勤时间不能修改!", vbOKOnly + vbExclamation, "警告"
If Not IsNull(rstWork.Fields("OnWorkFrom")) Then
Me.lblOnTime.Caption = Mid(CStr(rstWork.Fields("OnWorkFrom")), 11)
End If
If Not IsNull(rstWork.Fields("OnWorkTo")) Then
Me.lblOffTime.Caption = Mid(CStr(rstWork.Fields("OnWorkTo")), 11)
End If
If (Not IsNull(rstWork.Fields("OnWorkTo"))) And _
(Not IsNull(rstWork.Fields("OnWorkFrom"))) Then
intWorkHour = DateDiff("h", rstWork.Fields("OnWorkFrom"), rstWork.Fields("OnWorkTo"))
Me.lblHour.Caption = intWorkHour
End If
Exit Sub
Else
intWorkHour = DateDiff("h", rstWork.Fields("OnWorkFrom"), Now)
Me.lblOnTime.Caption = Mid(CStr(rstWork.Fields("OnWorkFrom")), 11)
Me.lblOffTime.Caption = Time
Me.lblHour.Caption = intWorkHour
strSQL = "update tbOnWork set OnWorkTo='" + CStr(Now) + "', WorkHour='" + CStr(intWorkHour)
strSQL = strSQL + "' where EmpId='" + Trim(gUserName) + "' and DateWork='" + StrDate + "'"
result = ExecuteSQL(strSQL, rstWork, True)
End If
End If
End Sub
大概的意思是什么,语句是什么? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询