Microsoft KB Archive/42063

Word: Unknown Field Name or Illegal Number in IF Statement

PSS ID Number: Q42063 Article last modified on 03-07-1997

=
========================================================= 4.00 5.00 5.10 MACINTOSH kbprint kberrmsg ——————————————————————– The information in this article applies to:

 == Microsoft Word for the Macintosh versions 4.0, 5.0, 5.1 == 

= SUMMARY =

In Word versions 5.0 and 5.1, the error message, “Unknown field name or illegal number in IF statement” may occur if the text that is being compared in an IF statement has not been enclosed in quotation marks.

In version 4.0 of Microsoft Word for the Macintosh, the error messages, “Not a Valid Integer for Comparison” or “Not a Valid Field to Compare To” may occur for one of the following three reasons when you are using IF statements to print conditional text in a print merge document:


 * 1) The text that is being compared in the IF statement has not been enclosed in quotation marks.
 * 2) One field is being compared to another field.
 * 3) The text that is being compared in the IF statement is empty and has not been enclosed in quotation marks.

Note: Word version 6.0 does not generate these error messages.

= MORE INFORMATION =

For example, suppose the fields “< >” and “< >” have values in the database that are text.

The following IF statement will generate the above error:

<> text to print <>

The correct syntax for the IF statement would be as follows:

<> text to print <>

Quotation marks are not needed around the text to match if the text is an integer.

The following IF statement is an example of the second case where the the above error message will be generated:

<>

Print merge fields can be compared only to constants (integers or text strings within quotation marks), as in the following examples:

<> or <>

The following IF statement is an example of the third case where the above error message will be generated:

<>

The comparison is meant to determine if the field is blank. The correct syntax for this type of comparison is as follows:

<> or <>

KBCategory: kbprint kberrmsg KBSubCategory: kbmerge Additional reference words: macword macword5 1.00 1.05 3.00 3.01 3.02 4.00 5.00 5.10 ====================================================================== ============================================================================= Copyright Microsoft Corporation 1997.