WD: Using the ASK Field with the IF Field in Word

Last reviewed: February 6, 1998
Article ID: Q66974

The information in this article applies to:
  • Microsoft Word for Windows, versions 1.0, 1.1, 1.1a
  • Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows 95, versions 7.0, 7.0a
  • Microsoft Word 97 for Windows
  • Microsoft Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a
  • Microsoft Word 98 Macintosh Edition

To use the ASK field conditioned upon the value of another field, include the IF statement inside the ASK field instead of including the ASK statement in the IF field.

Example 1: Entry of "none" for no spouse

The following example asks if you are married. If you respond with "Yes", it then asks for your spouse's name. If you respond with "No", it will then ask you to type "none". (The \*Firstcap switch is included so the response can be "yes" or "Yes".)

   {ASK Married "Are you married?" \*Firstcap}
   {ASK SpouseName {IF Married = "Yes" "What is your Spouse's Name?"
   "Type 'none'"}}
   {REF Married}
   {REF SpouseName}

In the this example, the second ASK field has an IF statement that determines if the bookmark "Married" is equal to "Yes." If it is, the IF field has the value "SpouseName." If not, the field has no value. The ASK field is not updated if it does not have a valid bookmark name as the first element; therefore, it does not ask the question.

Example 2: No entry for no spouse

The following example asks if you are married. If you respond with "Yes", it then asks for your spouse's name. If you respond with "No", it will enter No for the reference to the bookmark of "Married" and no question will be asked about the spouse; no entry will be made to the bookmark called "SpouseName".

{set SpouseName ""} {ask Married "Are you married?" \* firstcap} {ask{if{Married}="Yes" "SpouseName"}"What is your Spouses's name?"}


Additional query words: fill in conditional fillin word97
Keywords : kbtable winword winword2 word6 word7 word8 word95 word97
Version : WINDOWS:1.x,2.x,6.0,6.0a,6.0c,7.0,7.0a;MACINTOSH 6.0,6.0.1,6.0.1a 98
Platform : MACINTOSH WINDOWS


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