Article ID: 125316 - Last Review: November 15, 2004 - Revision: 4.0 Works: Use MONTH Function When Querying for Months in DatabaseThis article was previously published under Q125316 On This PageSUMMARY
In the Works for Windows Database module, querying for dates that fall
in a particular month can be done with the MONTH() function.
NOTE: In Works 4.0, 4.5, or 4.5a, these filters must be created using the Filter Using Formula option. In Works 3.0x, these queries must be entered in the Query view of the Database. The MONTH() function will return an integer from 1 to 12 specifying the month of the given date. For instance, the following formula will bring up all records which have the month of May in the BirthDate field.
=MONTH(BirthDate)=5
MORE INFORMATION
Below are some query examples using the MONTH() function to find records in
the database.
NOTE: The following queries will give you all records for the specified month(s), regardless of the year. To specify a month or range of months in a specific year, either use the actual dates in the query, or add the year function to the query as in the following example, where "Date" is the name of the field containing the date:
=MONTH(Date)=5#AND#YEAR(Date)=95
Using Works 4.0, 4.5, or 4.5a
Other Query ExamplesFor dates between two months (for example, between January and June):=MONTH(Date)>=1#AND#MONTH(Date)<=6
For dates in July or October:
=MONTH(Date)=7#OR#MONTH(Date)=10 Using Works for Windows 3.0x
Other Query ExamplesFor dates between two months (for example, between January and June):=MONTH()>=1#AND#MONTH()<=6
For dates in July or October:
=MONTH()=7#OR#MONTH()=10 Using Works for Windows 2.0
Other Query ExamplesFor dates between two months (for example, between January and June):=MONTH()>=1 & MONTH()<=6
For dates in July or October:
=MONTH()=7 | MONTH()=10 REFERENCES
"Microsoft Works for Windows User's Guide" (version 3.0), page 547,
Appendix A: "Spreadsheet and Database Functions."
"Microsoft Works for Windows User's Guide" (version 3.0), page 369 for information about using AND and OR operators. "Microsoft Works for Windows User's Guide" (version 2.0), page 278 for information about using AND and OR operators. APPLIES TO
| Article Translations
|

Back to the top
