Microsoft KB Archive/97791

= WD: SET Fields Within IF Field Evaluate Incorrectly =

Article ID: 97791

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft Word 2.0 Standard Edition
 * Microsoft Word 2.0a
 * Microsoft Office Word 2003
 * Microsoft Word 2.0c
 * Microsoft Word 6.0 Standard Edition
 * Microsoft Word 6.0a
 * Microsoft Word 6.0c
 * Microsoft Word 95 Standard Edition
 * Microsoft Word 95a
 * Microsoft Word 6.0 for Macintosh
 * Microsoft Word 6.01 for Macintosh
 * Microsoft Word 6.01 for Macintosh
 * Microsoft Word 98 for Macintosh

-



This article was previously published under Q97791





SYMPTOMS
When you use an IF field to determine how to set a bookmark, and you use SET fields inside the IF field, the bookmark being set always evaluates as the second SET statement.

For example, these statements {ask gender &quot;What is the person's gender?&quot;} --> {if gender = f {set pronoun she}{set pronoun he}} {ref pronoun} always show the bookmark &quot;pronoun&quot; as &quot;he.&quot; This is because Word evaluates fields from the inside out, and from left to right. It evaluates the first SET statement, and the bookmark &quot;pronoun&quot; is set to &quot;she.&quot; It then evaluates the next SET field, and the bookmark &quot;pronoun&quot; is reset to &quot;he.&quot; When the IF instruction is carried out, both the true bookmark and the false bookmark are &quot;he.&quot;



WORKAROUND
The correct way to use these fields together is to put the IF field inside the SET field, as in the following example: {ask gender &quot;What is the person's gender?&quot;} --> {set pronoun {if gender = f &quot;she&quot; &quot;he&quot;}} {ref pronoun}

Additional query words: winword2 define assign wrong value incorrect

Keywords: kbprb kbfield KB97791

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.