Article ID: 109703
Article Last Modified on 1/18/2007
Query: QueryTest
--------------------------------------------------------------
Field: DateDiff("d",Date()-(Day(Date()- 1)), DateSerial(Year _
(Date()),(Month(Date())+1),1))
Total: First
Show: True
This query will return an integer for the number of days in the current
month. For example, if the current month is April, the query will return
the integer 30.
Function DaysInMonth (MyDate)
' This function takes a date as an argument and returns
' the total number of days in the month.
Dim NextMonth, EndOfMonth
NextMonth = DateAdd("m", 1, MyDate)
EndOfMonth = NextMonth - DatePart("d", NextMonth)
DaysInMonth = DatePart("d",EndOfMonth)
End Function
?DaysInMonth(Date())
?DaysInMonth(#11/4/93#)
=DaysInMonth(<date value or variable>)
Keywords: kbhowto kbprogramming KB109703