Comparing Dates During Print Merge

Last reviewed: November 17, 1997
Article ID: Q63687
The information in this article applies to:
  • Microsoft Word for the Macintosh, versions 3.0, 3.01, 3.02, 4.0, 5.0, 5.1, 6.0

SUMMARY

To set up a print merge in Microsoft Word for the Macintosh that involves comparison of a date field in a data document to a specific date (such as today's date), the month, day, and year must be compared individually. That is, the date field in the data document must be split up into month, day, and year fields, as in the following example.

   Month   Day    Year     Name
   ------------------------------

   5       21     1990     John
   6       21     1990     David
   7       21     1990     Sue

The main document must also compare the year, month, and day fields against the specified date using embedded IF statements, as follows:

   <<set TodayMonth=?Enter Today's month as a number>>
   <<set TodayDay=?Enter Today's day as a number>>
   <<set TodayYear=?Enter Today's year as a number>>

   <<if TodayYear>=<<year>>>>
   <<if TodayMonth>=<<month>>>>
   <<if TodayDay>=<<day>>>>
        <<name>>
   <<ENDIF>>
   <<ENDIF>>
   <<ENDIF>>

MORE INFORMATION

For more information on using Word's print merge feature, see "Merging Documents" on pages 579-656 of the "Microsoft Word User's Guide" version 5.0 manual, or see "Form Letters" on pages 69-91 of the "Reference to Microsoft Word" version 4.0 manual, or see pages 64-92 in the "Reference to Microsoft Word" version 3.0 manual.


Additional query words: macword macword5 word6
Keywords : kbfield kbmerge kbprint
Version : MACINTOSH: 3.0, 3.01, 3.02, 4.0, 5.0, 5.10, 6.0, 6.0.1;
Platform : MACINTOSH


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.