Microsoft KB Archive/105890

-

{| The information in this article applies to:
 * width="100%"|
 * Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows NT, version 6.0
 * Microsoft Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a
 * Microsoft Word for Windows 95, versions 7.0, 7.0a
 * Microsoft Word 97
 * Microsoft Word 98 Macintosh Edition

SYMPTOMS
In Word, the results of form fields can be referenced elsewhere in the document, but they cannot be used in conditional statements.

For example, if you have a drop-down box whose bookmark name is dropdown1, and you use the following field to evaluate the result of dropdown1

{if { REF dropdown1 } = "female" "Dear Ms." "Dear Mr."} the result of this field will always be "Dear Mr.," regardless of what option was selected in the drop-down box.

CAUSE
In Word versions 6.x and 7.x, form fields are considered display fields, which means their results are pictures, not text strings that can be evaluated.

WORKAROUND
To work around this problem, use the REF field to reproduce the results of a form field.

Syntax of this field is

{REF bookmarkname} where "bookmarkname" can be the default name given to the bookmark or a custom name. To find the bookmark name, click Form Field on the Insert menu, and then click Options.

Word 97 for Windows or Word 98 Macintosh Edition
In Word 97 or Word 98, you can use the result of a form field in a conditional statement using the REF field as in the following example:

{if { REF Dropdown1 } = "female" "Dear Ms." "Dear Mr."} In addition, in these versions of Word you can turn on the Calculate on Exit form field option to cause the conditional field to be updated automatically. To turn on Calculate On Exit, follow these steps:
 * 1) If the document is protected for forms, click Unprotect Document on the Tools menu.
 * 2) Double-click the form field to view the form field options.
 * 3) Click to select the Calculate on Exit check box.
 * }

-

Last reviewed: February 2, 1998

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.