days between 2 dates w/o weekends

2

2Blessed4Stress

I am calculating the days between 2 dates in my qry using the DateDiff
function in my qry. How can I omit weekends from my day count?
 
W

Wayne-I-M

Hi

Create a new module and paste this into it

Function CountWODays(Date1 As Date, Date2 As Date) As Long
Dim DayCntr As Long, LoopDate As Date, WD As Long
DayCntr = 0
For LoopDate = Date1 To Date2
WD = Weekday(LoopDate)
If WD > 1 And WD < 7 Then '1-Sunday 7-Saturday
DayCntr = DayCntr + 1
End If
Next LoopDate
End Function


Save it and then in your query you can call it by putting something like in
the criteria section

WeekdaysCount: CountWODays([StartDate],[EndDate])



Hope this helps
 
W

Wayne-I-M

Hi Douglas.

I just open you pdf regarding simulated checkoxes (windings font).

Can I just say I thought it was really good. Thanks for the tips. It is
one of the question I get asked quite often (can you make that box bigger) I
have always said no but from now .....

Thanks
 

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