Microsoft KB Archive/105890

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 09:12, 20 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)



WD: Can't Use Result of Form Field in Conditional Statement

Last reviewed: February 2, 1998
Article ID: Q105890



The information in this article applies to:

  • 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.



Additional query words: checkbox results field codes

Keywords : kbfield macword winword word6 word7 word95 word97 macword98
Version : WINDOWS:6.0,6.0a,6.0c,7.0,7.0a,97; MACINTOSH:6.0,6.0.1,6.0.1a,98
Platform : MACINTOSH WINDOWS
Issue type : kbprb
Solution Type : kbworkaround


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