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

ID: Q211664


The information in this article applies to:
  • Microsoft Word 2000


SUMMARY

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.


MORE INFORMATION

The following are examples how to nest an IF conditional field inside an ASK field:

NOTE: In each of the following examples, <P> means press ENTER.

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}<P>
{ASK SpouseName {IF Married = "Yes" "What is your spouse's name?" "Type 'none'"}}<P>
{REF Married}<P>
{REF SpouseName}
In 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 its first element is not a valid bookmark name; 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 enters No for the reference to the bookmark of "Married." It does not ask for a spouse name or make an entry to the bookmark called "SpouseName."
{set SpouseName ""}<P>
{ask Married "Are you married?" \*Firstcap}<P>
{ask{if{Married}="Yes" "SpouseName"}"What is your spouses's name?"}

Additional query words: fill in conditional fillin

Keywords : kbdta kbfield wd2000
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbinfo


Last Reviewed: December 29, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.