Err Msg in Place of REF Field Result: Bookmark Not Defined

ID: Q98895

The information in this article applies to:

SUMMARY

If you type nothing in response to an ASK field prompt, Word for Windows records a null value, which may result in one of the following error message to appear as the result of the REF field that references the empty ASK field result:

Word 1.x and 2.x:       Error! Bookmark not defined.

Word 6.x, 7.x, and 97: Error! Reference source not found.

This happens because you cannot assign a bookmark to a null value. A bookmark must represent a value, such as a selection or the insertion point (the insertion point is not the same as a null value).

Workaround 1

To prevent the above error message from appearing, insert a SET field before the ASK field, as shown in the example below. The SET field assigns the insertion point, or no selection (""), to the bookmark (instead of a null value) so the error message does not occur.

   {SET address2 ""}{ASK address2 "What is the second line of
   the address?"}{REF address2}

This workaround assigns a blank value to the bookmark that Word can insert if a different value is not later assigned using the ASK field.

NOTE: The \d (default) ASK field switch has no effect on this workaround.

Workaround 2

Insert an IF field that compares the reference to the ASK field bookmark with a reference to an intentionally undefined bookmark. If the bookmarks are the same (which means that both produce the error message), Word inserts an alternate result.

NOTE: Be sure to choose a unique bookmark name as the intentionally undefined bookmark. If this bookmark name is later assigned to a value, the workaround fails.

In the following example, which illustrates this workaround, "xxxx" is an undefined bookmark name. If the value of the mybkmark bookmark is null, Word inserts "No name given" as the result of the IF field.

   {ASK mybkmark "Type your name:"}

Insert the following IF field in place of the REF field that references the ASK bookmark results:

   {IF {mybkmark} = {xxxx} "No name given" {mybkmark}}

Reference(s):

"User's Guide," version 2.0, pages 477-478, 640-644, 646-650

KBCategory: kbusage KBSubcategory: kbfield kbmerge Additional query words: 1.0 1.10 1.10a 2.0 2.0a 2.0a-CD 2.0b winword 7.0 word95 word7 word6 winword 2.0c 6.0 errmsg err msg print merge winword2 word97

Keywords          : kbfield kbmerge 
Version           : 1.x 2.x 6.0 6.0a 6.0c 7.0 7.
Platform          : WINDOWS

Last Reviewed: February 6, 1998