Article ID: 210448 - Last Review: October 11, 2006 - Revision: 3.2 HOW TO: Find the Number of Days in a Month in Access 2000This article was previously published under Q210448 On This PageSUMMARY
This article shows you two methods for returning the total number of
days in the current month. The first method uses a query, and the second
method uses a user-defined function. Query MethodNOTE: This method applies only to a Microsoft Access database (.mdb).Create the following new query based on any table. The Microsoft Jet database engine requires that each query is based on at least one table or query, even if you do not use a field from that table or query. The query will produce an error if there is no FROM clause. NOTE: In the following example, an underscore (_) is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this example.
Query: QueryTest
-----------------------------------------------------------------
Field: DateDiff("d",Date()-(Day(Date()- 1)), DateSerial(Year _
(Date()),(Month(Date())+1),1))
Total: First
Show: True
User-Defined FunctionNOTE: This method applies to a Microsoft Access database (.mdb) and a Microsoft Access project (.adp).Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
=DaysInMonth(<date value or variable>)
| Article Translations
|
Back to the top
