Countnig Days between dates

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
 
T

tina

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top