The information in this article applies to:
Moderate: Requires basic macro, coding, and interoperability skills. This article applies to a Microsoft Access database (.mdb) and a Microsoft Access project (.adp). SUMMARYThis 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. MORE INFORMATIONQuery 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.
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.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, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web: http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.asp
=DaysInMonth(<date value or variable>) Additional query words: inf
Keywords : kbprg kbdta AccCon PgmHowto |
Last Reviewed: July 6, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |