Count the day of the week in Access

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

Guest

I want to run a query that counts the amount of employees that were out on a
Mondays,Tuesdays,Etc.
 
How about helping us help you ... by posting some more details about the
data, the table structure, etc.? ;-)
 
Not a problem, the table is part of an attendance DB and it contains a unique
number and the dates of absent it's formated as a short date. I would like to
be able to see what the average is for each day, Monday, Tuesday, Etc, when I
change the format to a long date and try and run a query it doesn't work. I
hope this helps you to help me.
 
You can get the day of the week (as a number) using the DatePart function.
It returns a value of 1 to 7, depending on the day of the week and on which
day you designate as the first day of the week (it defaults to Sunday as day
1 otherwise). For example,

?DatePart("w", #7/31/2005#)
1
?DatePart("w", #7/31/2005#, vbSunday)
1
?DatePart("w", #7/31/2005#, vbMonday)
7

Thus, you can use the absence dates as the source date for the DatePart
funcion. And your query can use the result to group the query's output.
--

Ken Snell
<MS ACCESS MVP>
 
Back
Top