|
Function newNetWorkDays(BegDate As Date, EndDate As Date) As Integer
Dim DateCnt As Date
Dim EndDays As Date
Dim IntDays As Integer
DateCnt = DateValue(BegDate)
EndDays = DateValue(EndDate)
IntDays = 0
Do While DateCnt <= EndDays
If Format((IsNull(DLookup("id", "holiday", "ÐÝÏ¢ÈÕÆÚ=#" & DateCnt & "#"))) _
And Format(DateCnt, "ddd") <> "Sun" And Format(DateCnt, "ddd") <> "Sat") Or _
Format(Not IsNull(DLookup("id", "workday", "¼Ó°àÈÕÆÚ=#" & DateCnt & "#"))) Then
IntDays = IntDays + 1
End If
DateCnt = DateAdd("d", 1, DateCnt)
Loop
newNetWorkDays = IntDays - 1
End Function
这个代码能够计算出如果BegDate小于或等于EndDate的相差工作日,但是如果大于,则计算出的所有值都是-1,请问能够将负值也体现出差别多少工作日吗,而不是全部都显示-1 |
|