1. Removed the creation of a DAO recordset in the code. Maybe that was a dumb move (I honestly have no idea), but it made it simpler to read/understand.
I started out in one direction and ended up going another.... and didn't clean up the unused code. (too many other things going on - read work)
Does the DAO recordset in the code speed things up?
No, slower (by milliseconds - you'll probably never notice though ). But still, shouldn't have garbage code in a procedure.
Code:
4. Changed the code so that if I need to change the office start or end dates I only need to change it up top (replaced any reference to 8 hours with "DateDiff("h", OfficeStart, OfficeEnd)".
Still one line where 8 (hrs) is hard coded...??? (If TotHrs > 8 Then ...)
Along that vein, towards the top of the code, I might do
Code:
Dim HrsPerDay as Single
.
.
HrsPerDay = DateDiff("h", OfficeStart, OfficeEnd)
True, it will save maybe a millisecond or 2, but does add to ease of reading. (And my personal preference is to never use the single line IF() statement syntax)
I see I forgot to check in the first or last day is a weekend day.
I have to say "nice job". Good catches on my errors.