WD2000: How to Use Calculate on Exit in a Form

ID: Q212244


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


SUMMARY

In Word 2000, form fields include a Calculate On Exit option. This option, when turned on, updates fields and form fields in a form document.

Fields not updated by this option include:

TOC
PAGE
INDEX
PAGEREF


MORE INFORMATION

This option is especially useful when you automate documents and need to update calculation of text form fields automatically or to repeat text typed in one form field in other locations in the same document.

Example of Using Calculation with a Text Form Field

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 click Forms to turn on the Forms toolbar.


  3. On the Forms toolbar, click the Text Form Field button to insert a text form field, and then press ENTER.


  4. Insert two additional text form fields in the same manner, and press ENTER after you insert each form field.


  5. Double-click the first form field (or right-click the field and 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, click to select the Calculate On Exit check box, and click OK.




  6. Repeat step 5 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. For Expression, type:
      =SUM(Text1,Text2)




  8. Click OK.


NOTE: Word uses Text# bookmark names (where # is a number) to sequentially name each new text form field. The first two text form fields have bookmark names of Text1 and Text2. Capitalization is important. In this example, the expression returns the sum of the first two text form fields.

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, type a name, and then click Save.


  4. On the File menu, click Close to close the template.


Test the Template

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


  2. Type a number in the first form field and press TAB.


  3. Type a number in the second form field and press TAB.


Notice that when you quit either of the first two form fields, the calculation form field is updated. For additional information, please see the following article in the Microsoft Knowledge Base:
Q212328 WD2000: How to Create an Online Form Using Form Fields

Example of Using the REF Field

Create the Document with the REF Field

To repeat the result of a 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 click Forms to turn on the Forms toolbar.


  3. On the Forms toolbar, click the Text Form Field button to insert a text form field.


  4. Double-click the form field to access its options.


  5. Under Field Settings, click to 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 end result appears as follows:
    REF Text1


  10. Click OK.


  11. Note that Text1 is the bookmark name of the form field. Capitalization is important.

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, type a name, and then click Save.


  4. On the File menu, click Close to close the template.


For additional information, please see the following article in the Microsoft Knowledge Base:
Q212356 WD2000: How to Update Fields in a Protected Form

Additional query words: table of contents page reference example 9.0

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


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