Calculates Number of days... month... year

Valery

Registered User.
Local time
Today, 09:46
Joined
Jun 22, 2013
Messages
363
Hi,

I am building a report and need to know the coding in the query (or in the report) to achieve the following.

Currenly, in my query - 3 fields that work fine:

AppDate - dates of set appointments (Appt)

MonthNo: DatePart("m",[App_Date]) - get Month value

YearNo: DatePart("yyyy",[App_Date]) - get Year value

What I need is : EXACT coding to get these counts to show in my report:

January 2013
12 appointment (there were a count of 12 appts in January)
over 23 days (there were 23 days where appts were booked in January)
of 31 days (total number of days in the month of January)

February 2013
18 appts (there were a count of 12 appts in February )
over 19 days (there were 23 days where appts were booked in January)
of 28 days (total number of days in the month of February )

etc.

Your assistance is much appreciated. I am a newbie. Please, please, be specific as to the not only the coding itself but where it is to be inserted.

THANK YOU
 
Last edited:
I got it! all by myself!!!

Here is the answer - works great:

=DateSerial([YearNo],[MonthNo]+1,1)-DateSerial([YearNo],[MonthNo],1)

Thank you to myself - :D
 
To further expound upon this, I needed to simply find the number of days in a month, from a format of month/day/year, which I obtained by modifying Valery's formula in this way:

Code:
Day(DateSerial(Year([dteFcstPrd]),Month([dteFcstPrd])+1,1)-1)

in the query.

There may be a simpler form of this formula, but this worked for me.
 

Users who are viewing this thread

Back
Top Bottom