WD: How to Test a Field For Text or Number in Print Merge

Last reviewed: February 5, 1998
Article ID: Q77892

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, 5.1a

SUMMARY

When preparing a Microsoft Word for the Macintosh print merge, sometimes it is necessary to check a field to determine if the field contains a number or text before performing an action.

To determine whether a field contains text, a number, or is blank, use the following command:

   <<IF fieldname>> <<IF fieldname>"999999999">> Action if fieldname is
   text <<ELSE>> Action if fieldname is number or if fieldname is blank
   <<ENDIF>> <<ELSE>> Action is fieldname is blank <<ENDIF>>

MORE INFORMATION

This method looks at numbers as a text strings. For example, the number 10 is considered to be smaller than the number 9. However, the number 99 is correctly considered to be greater than the number 9.

In the above example, the limit value is 999999999. If a data document's greatest number has 5 characters, such as 93748, you must use 99999 as the limit value. A string of zeros always is seen as a number.

Using a large value like 999999999 as your limit value should force Word to pick up all numbers in a data document.

NOTE: Spaces in a field are considered as numbers; spaces separated by tabs or commas are considered blank.

Some punctuation marks are considered numbers, others are considered text. The following is a partial list:

   Number: . , ! # $ % & * ( )

   Text: ? @ ^


Additional query words: database limits
Keywords : kbfield kbmerge macword kbprint
Version : MACINTOSH:3.0,3.01,3.02,4.0,5.0,5.1,5.1a
Platform : MACINTOSH
Issue type : kbhowto


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: February 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.