Count days in a month

pickslides

Red Sails In The Sunset
Local time
Today, 19:56
Joined
Apr 29, 2008
Messages
76
Hi all,

I have fields for an employee database & require an access formula to count how many days an employee was employed within a certain month

A have attached an excel sheet with some sample data.

Thanks for your support, MQ
 

Attachments

Have a look at the DCount() function your criteria might look something like;
Code:
= DCount("AttendanceDate", "YourAttendanceTableName", "EmployeeID = " & Me.EMployeeID & " And [URL="http://www.techonthenet.com/access/functions/date/month.php"]Month[/URL](AttendanceDate) = " & Me.MonthNumber)
 
Forget that, it's going to be a little more tricky than I first anticipated :o
 
This has enough variables to be best tackled in a function.

Even the days in the month has a variable in February and leap years.

Brian
 
Got it :D try the attached.

Brian I think you now know how/why I stumbled on that little error we were speaking of elsewhere ;)
 

Attachments

You were looking to plagarise some code ? :D

I tried to look at what you had done but I need an MDB.
I am rapidly coming to the conclusion that it is time for me to give up, more and more I am out of date. I retired 7 years ago and only use Access on the forum so what little knowledge I had is fading and becoming dated, I doubt that I will fork out the price for Access when I replace my old PC (circa2002).

Cheers

Brian
 
Plagiarise, that's a little harsh isn't it :eek: I'm simply borrowing and improving :D

Here try the attached.
 

Attachments

Brian is of course correct and I should in fact have linked to thread that provided the function that is doing the hard work here :o
 
John
I had a master at my grammar school who said
"There is knowledge and there is knowledge of the knowledge , the latter is just as important"

An analogy for us is that you know a function or code example you can look it up
It is better to know that DSum, Dmax, DLookup etc exist rather than just know all about say DLookup

You knew that code existed borrowing it is just progress.

Brian
 

Users who are viewing this thread

Back
Top Bottom