Count the day of the week in Access

G

Guest

I want to run a query that counts the amount of employees that were out on a
Mondays,Tuesdays,Etc.
 
K

Ken Snell [MVP]

How about helping us help you ... by posting some more details about the
data, the table structure, etc.? ;-)
 
G

Guest

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.
 
K

Ken Snell [MVP]

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>
 

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