-
Date Function
I need to code a Date Function that calculates work days only but it's not working. Can someone help?
Here's the function:
Public Function DifferenceInDates(sStartDate, sEndDate)
Dim iDays
Dim iWorkDays
Dim sDay
Dim i
DifferenceInDates() As Integer
iDays = DateDiff("d", sStartDate, sEndDate)
iWorkDays = 0
For i = 0 To iDays
'First day of the week is Sunday
sDay = Weekday(DateAdd("d", i, sStartDate))
If sDay <> 1 And sDay <> 7 Then
iWorkDays = iWorkDays + 1
End If
Next
DifferenceInDates = iWorkDays
-------------------------------------
And here is the portion of the code I'm using it in:
iWorkDays = -(DateDiff("d", date, DateTrigger))
If iWorkDays < 4 Then DoCmd.SendObject acSendNoObject, , , vString, vString2, , "Signature Requested", "Drawing# " & DocTrigger & " (for " & CycleTrigger & ") submitted for the " & ProgramTrigger & " program has been on the sign-off table since " & DateTrigger & ". Please sign.", False
End If
If iWorkDays > 3 And iWorkDays < 6 Then DoCmd.SendObject acSendNoObject, , , vString & vString2, vString3, , "Important Information!", "Drawing# " & DocTrigger & " (for " & CycleTrigger & ") submitted for the " & ProgramTrigger & " program has been on the sign-off table since " & DateTrigger & ".", False
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|