Insert or update a field code

Fields in Word are used as placeholders for data that might change in a document and for creating form letters and labels in mail-merge documents. Fields, also known as field codes, are different from the type of fields that are used to enter information, such as on a form. Word automatically inserts fields when you use particular commands, such as when you insert a page number, a document element such as a cover page, or when you create a table of contents. You can also manually insert fields to automate aspects of your document, such as merging data from a data source or performing calculations. However, in most cases it is easier to use the commands and options that are provided in Word to add the information that you want. For example, you can insert a hyperlink by using the HYPERLINK field, but it is easier to use the Hyperlink command on the Insert menu.

Field codes appear between curly brackets { }. A fieldA set of codes that instruct Word to automatically insert text, graphics, page numbers, and other information into a document. For example, the DATE field inserts the current date, and the TIME field inserts the current time. You can also use fields to insert variable data into data-merge documents, such as form letters. behaves like a formula in Excel — the field codePlaceholder text that shows where information from your data source will appear; the elements in a field that generate a field's result. The field code includes the field characters { }, field type, and instructions. is like the formula (which is hidden), and the field result is like the value that the formula produces (which is visible). You can switch between displaying field codes and results in your document by pressing OPTION+F9. When you view a field code in your document, the syntax looks like this: { FIELD NAME Properties Optional switches }.

Syntax

Description

FIELD NAME

The name that appears in the list of field names in the Field dialog box.

Properties

Instructions or variables that are used in a particular field. Not all fields have parameters, and in some fields, parameters are optional instead of required.

Optional switches

Optional settings that are available for a particular field. Not all fields have switches available, other than those that govern the formatting of the field results.

For example, you can place the file name and path of your document in the header or footer by inserting the FILENAME field. The syntax for the FILENAME field code with the path that is included looks like this: { FILENAME \p }

Do any of the following:

Insert a field

Update an individual field

Update all fields when you print

Lock or unlock a field

Change the shaded background of fields

Apply text formatting to a field