Counting Days

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having a difficult time trying to count the # of days in a query. I need
to count the # of work week days in a given month e.g 2-6 is M-F. In Jan
there's 22 in 2004. I spent the whole morning trying to get this to work.

Thanks
 
Hi,


DateDiff("ww", ... ) returns the number of changes of week between the two
dates. Fortunately, the start of the week is a parameter. So, to get the
number of Saturdays:


? DateDiff("ww", #01-01-2005#, #02-01-2005#-1, vbSaturday)


and for the number of Sunday, you got is, we use vbSunday.


Note the second argument is the first of the inquired month, while the third
argument is the first of the next month, minus 1.



Hoping it may help,
Vanderghast, Access MVP
 
Hi,


Sorry, in a query, we cannot use predefined VBA constants. You have to
use 7 and 1, not the symbolic name of the constants, inside a query.

? vbSaturday, vbSunday
7 1


Hoping it may help,
Vanderghast, Access MVP
 
Back
Top