Microsoft KB Archive/212244

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

Article ID: 212244

Article Last Modified on 7/27/2006

-

APPLIES TO


 * Microsoft Word 2002 Standard Edition
 * Microsoft Word 2000 Standard Edition

-



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



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:  Create a new document. On the View menu, point to Toolbars, and then click Forms to display the Forms toolbar. On the Forms toolbar, click Text Form Field to insert a Text form field, and then press ENTER twice. Insert two additional Text form fields in the same way, and press ENTER twice after you insert each form field. 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:  Under Type, select Number.</li> Under Field Settings, select the Calculate on exit check box, and then click OK.</li></ol> </li> Repeat step e for the second form field.</li> Double-click the last form field to access its options. Set the options to the following: <ol> Under Type, select Calculation.</li> 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.</li></ol> </li> Click OK.</li></ol>

Step 2: Save the Document as a Protected Template
To save and protect your form template, follow these steps: <ol style="list-style-type: lower-alpha;"> Protect the template. To do this, click Protect Document on the Tools menu. Under Protect document for, click Forms, and then click OK.</li> Save the document as a template by clicking Save As on the File menu.</li> Under Save as type, select Document Template (*.dot), type a name in the File name box, and then click Save.</li> On the File menu, click Close to close the template.</li></ol>

Step 3: Test the Template
To test the template, follow these steps: <ol style="list-style-type: lower-alpha;"> 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.</li> Type a number in the first form field, and then press the TAB key.</li> Type a number in the second form field, and then press the TAB key.</li></ol>

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: <ol style="list-style-type: lower-alpha;"> Create a new document.</li> On the View menu, point to Toolbars, and then click Forms to display the Forms toolbar.</li> On the Forms toolbar, click Text Form Field to insert a Text form field.</li> <li>Double-click the form field to access its options.</li> <li>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.</li> <li>Press the RIGHT ARROW key to turn off selection of the form field.</li> <li>Press ENTER four times to insert blank lines.</li> <li>On the Insert menu, click Field. Under Categories, select Links and References. Under Field Names, select Ref.</li> <li>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.</li> <li>Click OK.</li></ol>

Step 2: Save the Document as a Protected Template
To save and protect the document, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>Protect the template. To do this, click Protect Document on the Tools menu. Under Protect document for, click Forms, and then click OK.</li> <li>Save the document as a template by clicking Save As on the File menu.</li> <li>Under Save as type, select Document Template (*.dot), type a name in the File name box, and then click Save.</li> <li>On the File menu, click Close to close the template.</li></ol>

Step 3: Test the Template
To test the template, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>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.</li> <li>Type some text in the form field, and then press the TAB key.</li></ol>

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.

Additional query words: table of contents page reference example 9.0 10.0

Keywords: kbinfo kbautomation kbforms kbfield KB212244

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.