WD97: How to Use Calculate on Exit in a Forms Document

This article was previously published under Q157463
This article has been archived. It is offered "as is" and will no longer be updated.
SUMMARY
In Microsoft Word 97 for Windows, form fields include a Calculate OnExit option. This option, when enabled, updates fields and form fields in aform 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 toupdate calculation of text form fields automatically or to repeat texttyped 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. On the View menu, point to Toolbars, and click Forms to enable the Forms toolbar.
  2. On the Forms toolbar, click the Text Form Field button to insert a text form field, and then press ENTER.
  3. Insert two additional text form fields in the same manner, and press ENTER after you insert each form field.
  4. 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.
  5. Repeat step 4 for the second form field.
  6. 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)
  7. Click OK.
NOTE: Word uses Text# bookmark names (where # is a number) to sequentiallyname each new text form field. The first two text form fields have bookmarknames of Text1 and Text2. Capitalization is important. In this example, theexpression 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. Save the document as a template by clicking Save As on the File menu. Under Save As Type, select Document Template, type a name, and then click Save.
  2. Protect the template. To do this, click Protect Document on the Tools menu, under Protect Document For, click Forms, and then click OK.
  3. Save and 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 exit either of the first two form fields, thecalculation form field is updated.

For additional information, please see the following articles in theMicrosoft Knowledge Base:
110014 WD: Calculation Text Fields Within Forms Fail to Update

141990 WD97: How to Create an Online Form Using Form Fields

EXAMPLE OF USING THE REF FIELD

Creating 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. On the View menu, point to Toolbars and click Forms to display the Forms toolbar.
  2. Click the Text Form Field button on the Forms toolbar to insert a text form field, and then press ENTER.
  3. Double-click the form field to access its options.
  4. 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.
  5. Press the RIGHT ARROW to remove selection from the form field, and press ENTER four times to insert blank lines.
  6. On the Insert menu, click Field. Under Categories, select Links and References. Under Field Names, select Ref.
  7. In the Field codes box, type "REF Text1" (without the quotation marks), and click OK.

    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. Save the document as a template by clicking Save As on the File menu. Under Save File As Type, select Document Template, type a name, and then click Save.
  2. Protect the template. To do this, click Protect Document on the Tools menu, under Protect Document For, click Forms, and then click OK.
  3. Save and close the template.

Testing 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 text form field and press TAB.
When you exit the form field, the REF field is updated. This fieldduplicates the contents of the text form field.
table of contents page reference example 8.0
Properties

Article ID: 157463 - Last Review: 12/04/2015 15:31:26 - Revision: 1.2

Microsoft Word 97 Standard Edition

  • kbnosurvey kbarchive kbfield kbinfo KB157463
Feedback
ERROR: at System.Diagnostics.Process.Kill() at Microsoft.Support.SEOInfrastructureService.PhantomJS.PhantomJSRunner.WaitForExit(Process process, Int32 waitTime, StringBuilder dataBuilder, Boolean isTotalProcessTimeout)