How to update Text form fields automatically by using the Calculate on exit option in Word 2000 or Word 2002 (212244)



The information in this article applies to:

  • Microsoft Word 2002
  • Microsoft Word 2000

This article was previously published under Q212244
For a Microsoft Word 97 version of this article, see 157463.
For a Microsoft Word 98 version of this article, see 180686.

SUMMARY

When you automate a form, text that you type into a Text form field appears automatically in other locations in the same document. Form fields in Word include a Calculate on exit option. The Calculate on exit option is especially useful when you automate documents and need to update the calculation of Text form fields automatically or to repeat text that is typed in one form field in other locations in the same document.

This article demonstrates how to use the

MORE INFORMATION

Example 1: Text Form Fields That Perform Calculations

This example creates a new form template that contains two Number Text form fields and a Calculation form field. When you press the TAB key to quit either of the first two form fields, the Calculation form field is automatically updated with the result.

back to the top


Step 1: Create a New Document with Text Form Fields

To create a new document with Text form fields, follow these steps:
  1. Create a new document.
  2. On the View menu, point to Toolbars, and then click Forms to display the Forms toolbar.
  3. On the Forms toolbar, click Text Form Field to insert a Text form field, and then press ENTER twice.
  4. Insert two additional Text form fields in the same way, and press ENTER twice after you insert each form field.
  5. Double-click the first form field (or right-click the field and then click Properties on the shortcut menu) to access its options. Set the options to the following:
    1. Under Type, select Number.
    2. Under Field Settings, select the Calculate on exit check box, and then click OK.
  6. Repeat step e for the second form field.
  7. Double-click the last form field to access its options. Set the options to the following:
    1. Under Type, select Calculation.
    2. In the Expression box, type =SUM(Text1,Text2).

      NOTE: Text1 and Text2 in this example are the bookmark names for the first two Text form fields that you inserted in steps c and d. To determine the correct bookmark name for each Text form field, double-click each form field, and then view the Text Form Field Options dialog box.
  8. Click OK.


Step 2: Save the Document as a Protected Template

To save and protect your form template, follow these steps:
  1. Protect the template. To do this, click Protect Document on the Tools menu. Under Protect document for, click Forms, and then click OK.
  2. Save the document as a template by clicking Save As on the File menu.
  3. Under Save as type, select Document Template (*.dot), type a name in the File name box, and then click Save.
  4. On the File menu, click Close to close the template.



Step 3: Test the Template

To test the template, follow these steps:
  1. On the File menu, click New, and then open a document that is based on the newly created template.

    NOTE: In Microsoft Word 2002, click General Templates in the New Document task pane, click to select the template that you created, and then click OK.
  2. Type a number in the first form field, and then press the TAB key.
  3. Type a number in the second form field, and then press the TAB key.
Notice that when you press the TAB key to quit either of the first two form fields, the Calculation form field is updated automatically.

Example 2: Text Form Fields That Are Used with Reference (REF) Fields

This example creates a new form template that contains a Text form field and a Reference (REF) field. When you press ENTER to quit the Text form field, the text that you typed in the form field is automatically updated in the Reference (REF) field.



Step 1: Create the Document with the REF Field

To repeat the result of a Text form field in another location, use a REF field. To do this, follow these steps:
  1. Create a new document.
  2. On the View menu, point to Toolbars, and then click Forms to display the Forms toolbar.
  3. On the Forms toolbar, click Text Form Field to insert a Text form field.
  4. Double-click the form field to access its options.
  5. Under Field Settings, select the Calculate On Exit check box, and then click OK.

    Notice that Word assigns the Text1 bookmark name to the form field.
  6. Press the RIGHT ARROW key to turn off selection of the form field.
  7. Press ENTER four times to insert blank lines.
  8. On the Insert menu, click Field. Under Categories, select Links and References. Under Field Names, select Ref.
  9. In the Field codes box, type Text1 so that the result appears as follows:

    REF Text1

    NOTE: In Microsoft Word 2002, in the Field dialog box, click Field Codes to access the Field codes box.

    NOTE: Text1 is the bookmark name of the form field that you inserted in step c. The name is case-sensitive.
  10. Click OK.


Step 2: Save the Document as a Protected Template

To save and protect the document, follow these steps:
  1. Protect the template. To do this, click Protect Document on the Tools menu. Under Protect document for, click Forms, and then click OK.
  2. Save the document as a template by clicking Save As on the File menu.
  3. Under Save as type, select Document Template (*.dot), type a name in the File name box, and then click Save.
  4. On the File menu, click Close to close the template.


Step 3: Test the Template

To test the template, follow these steps:
  1. On the File menu, click New, and then open a document that is based on the newly created template.

    NOTE: In Microsoft Word 2002, click General Templates in the New Document task pane, click to select the template that you created, and then click OK.
  2. Type some text in the form field, and then press the TAB key.
Notice that when you press the TAB key to quit the form field, the REF field is updated automatically with the same text that you typed into the form field.


Modification Type:MinorLast Reviewed:7/27/2006
Keywords:kbForms kbAutomation kbfield kbinfo KB212244