Countnig Days between dates

  • Thread starter Thread starter Jeff F
  • Start date Start date
J

Jeff F

I need to be able to count the days between dates to track processing time.
I know that Datedif does this but I need to subtract the weekend.

Jeff F
 
try adding the following code to a standard module, as

Public Function isDayCount(ByVal dat1 As Date, ByVal dat2 As Date) As
Integer

Dim i As Integer

Do
dat1 = dat1 + 1
If DatePart("w", dat1, vbMonday) < 6 Then i = i + 1
Loop Until dat1 = dat2

isDayCount = i

End Function

you can call it from a query, or from anywhere else that you can call a
built-in function. and you can adjust the variable i - and the function
return data type - from Integer to Long Integer or Byte, if either one
better fits your needs.

hth
 
Back
Top