Home > Articles > Home & Office Computing > Microsoft Applications

  • Print
  • + Share This
This chapter is from the book

Selecting the Right Field

A big part of using fields successfully in Word is knowing which fields are available and which are most applicable to a particular situation. The following sections explain the types of fields available.

Date and Time Fields

In Chapter 7, “Formatting Documents and Sections,” you learned that you can click Date & Time on the Insert tab to insert a date or time code via a dialog box interface. If you mark the Update Automatically check box in this dialog box, Word inserts a {Date} field rather than the actual date or time. If you toggle the field code on an inserted date (Shift+F9), it might look something like this:

{ Date \@ "M/d/yyyy" }

The main switch for the {Date} field is \@, which is followed by the syntax for the date or time format you want.

The {Date} field has a few other switches, but you’ll probably never use them:

  • \h is for the Hijri/Lunar calendar.
  • \l is used to insert the date with the last format chosen using the Date and Time dialog box.
  • \s is used for the Saka Era calendar.
  • \u is used for the Um-al-Qura calendar.

You might be surprised to find that inserting a time with the Date and Time dialog box does not insert a {Time} field. Instead, it inserts a {Date} field with time-based formatting. For example:

{ Date \@ "HH:mm" }

So what’s the {Time} field for? It’s basically the same as {Date}, except with fewer options. You can’t specify a certain alternative calendar via switches, for example. Strictly speaking, the {Time} field is redundant. It doesn’t need to exist, except that people expect it to and might not think to use a {Date} field to express a time.

  • arr.jpg To learn how to create custom date and time formats, see “Constructing a Custom Date or Time Format,” p. 644.

Besides the {Date} and {Time} fields, there are several other date/time-related fields from which you can choose. All of them pull their information from the file’s properties, not from the PC’s clock/calendar.

  • {CreateDate} displays the file creation date. It never changes, because the document’s creation date never changes.
  • {PrintDate} displays the date on which the document was last printed. It updates itself automatically when you print the document.
  • {SaveDate} displays the date on which the document was last saved. It updates itself automatically when you save the document.
  • {EditTime} displays the total amount of time spent editing the document. It does not update automatically.

Document Information Fields

As you learned in “Inserting a Document Property” in Chapter 7, each document has a set of properties. Some of those properties are editable, such as Author; others are automatically calculated by Word, such as FileSize. You can insert these document properties into the document using the document information fields.

Most of these fields have an obvious one-to-one correlation with a certain property. For example, the {Author} field inserts the author’s name, the {Comments} field inserts any comments that have been placed in the document properties, and so on. The field properties vary depending on the nature of the information being inserted. Fields that insert text have properties for setting text case; fields that insert numbers have properties for choosing a number format. Some fields also have additional options. For example, in Figure 16.4, the {FileSize} field’s result can be expressed in either kilobytes or megabytes.

If you do an item-by-item check of fields versus properties, you will find that not every document property has a corresponding field. The {DocProperty} field helps overcome this problem. It is a generic inserter for whatever document property you specify. Its list of available properties includes every property available for the document (except custom properties).

For example, suppose that you want to insert the company name from the Company property. There is no Company field, so you would use {DocProperty} like so:

{ DocProperty Company }

User Information Fields

These three simple fields pull user information from Word. They are somewhat like the document information fields. However, this data is not stored with the document, but with the logged-in user on the PC:

  • {UserAddress} inserts the user’s address, if set up in the program. To set up an address, choose File, Options, and click Advanced. In the General section, enter the address into the Mailing Address box.
  • {UserInitials} inserts the user’s initials, if set up in the program. To set up initials, choose File, Options, click General, and enter the initials into the Initials box.
  • {UserName} enters the user’s name, if set up in the program. To set up the name, choose File, Options, click General, and enter the name into the User Name box.

Numbering Fields

The numbering fields have one thing in common: They help you automatically number various types of items in your document. Each is automatically updated whenever you add more numbering fields or rearrange existing fields. For example, if you switch the positions of two figure captions, they also switch numbering.

Most of the numbering fields are inserted via Word’s user interface in various contexts, but a few are available only via the Field dialog box. The numbering fields are listed here:

  • {AutoNum} inserts an automatic number. You can specify the formatting you want for it (Arabic, Roman, letters, and so on). Use this to number anything you like. Each {AutoNum} code in the document shows an incremented value.
  • {AutoNumLgl} inserts an automatic number in legal format, with or without a trailing period.
  • {AutoNumOut} inserts an automatic number in outline format.
  • {BarCode} inserts a delivery point bar code based on the text found in a bookmark. Generally, the bookmark points to a ZIP Code field and changes for each mail merge record with the {Set} field.
  • {ListNum} inserts numbering for a list. This is somewhat like {AutoNum}, but rather than there being three separate fields for regular numbers, legal numbers, and outlines, there are field properties that define which type of list to use. The valid values for this property are LegalDefault, NumberDefault, and OutlineDefault. Another difference is that you can set the level in the list, and you can set a start-at value, so you can have some control over the list.

  • {Page} inserts the number of the current page. You most commonly use this in headers and footers, but you can use it anywhere in the document.
  • {RevNum} counts the number of times the document has been saved. Each time it is saved, the {RevNum} counter is incremented.
  • {Section} displays the section number where the field is placed.
  • {SectionPages} displays the total pages in the section where the field is placed.
  • {Seq} inserts an automatic sequence number. This is the field used for figure captions and other automatically numbered items. A bookmark is created to indicate what type of item is being sequenced. For example, to automatically number figures, each figure has a caption like this: Figure { Seq Figure }. Optional switches can be added for formatting—for example, { Seq Figure \? ARABIC }.

Equations and Formulas Fields

The math-related Equations and Formulas fields are mostly covered elsewhere in Word; you will seldom have reason to insert them manually via the Field dialog box. Here’s a quick round-up of them:

  • {=} is a formula field. Do not try to construct its syntax manually; instead, click the Formula button in the Field dialog box and construct the formula via the Formula dialog box.

  • {Advance} offsets the position of the subsequent text by a specified number of points in a specified direction. You might use this to fine-tune the positioning of text on a page when trying to make printed text line up correctly on a preprinted form, for example.
  • {Eq} inserts an equation using the legacy-style Equation Editor (that is, the version from Word 97-2003). Word does not recommend that you construct the syntax manually; click the Equation Editor button in the Field dialog box to open the legacy Equation Editor.
  • {Symbol} inserts a symbol, by character number, from a specified font. If no font is specified, the font assigned to the paragraph where the field resides takes precedence. Usually, it is preferable to use the Symbol insertion controls on the Insert tab to insert a symbol because you can browse for the desired symbol more easily (that is, you don’t have to know its number).

Index and Tables Fields

The Index and Tables fields mark entries for tables of contents, indexes, and tables of authorities; then they generate those items. (The Tables in this category’s name refers to tables of contents, tables of authorities, and tables of figures, not to ordinary Word tables.)

These codes are hardly ever inserted manually. You would typically use the Table of Contents, Table of Authorities, or Index feature in Word to insert the markers and generate the listings. However, it is useful to know what the various codes mean, in case you see them in documents and need to decide whether to keep or delete them.

These are the codes for indexes:

  • {XE} marks index entries. Various properties and options are available for defining an entry, but these are best created with the Mark Index Entry dialog box (covered in Chapter 19, “Creating Tables of Contents and Indexes”).
  • {Index} generates the index.

For tables of contents, these codes apply:

  • {TC} marks table of contents entries. Usually, tables of contents are generated automatically based on heading levels, but you can use this field to manually mark some text to be included.
  • {TOC} generates the table of contents.

For tables of authorities:

  • {TA} marks the table of authorities entries.
  • {TOA} generates the table of authorities.

For any of the types of reference tables (table of contents, index, table of authorities):

  • {RD} creates an index, table of contents, table of figures, or table of authorities by using multiple documents.
  • arr.jpg To create an index, see “Marking Index Entries,” p. 751, and “Generating the Index,” p. 759.
  • arr.jpg To create a table of contents, see “Creating a Table of Contents,” p. 731.
  • arr.jpg To create a table of authorities, see “Creating Citations and Tables of Authorities,” p. 747.

Links and References Fields

The Links and References category contains fields that insert linked content from other locations, as well as fields that automatically number pages and footnotes. (Automatic numbering of other items, such as list numbering or figure caption numbering, is handled by fields in the Numbering category, covered previously in this chapter.)

Several of the linking-type fields were covered in Chapter 15, “Copying, Linking, and Embedding Data.” Here’s a quick review of those:

  • {Hyperlink} inserts a hyperlink. Hyperlinks are more commonly inserted via the Hyperlink command on the Insert tab.
  • {Link} inserts an OLE link to an object. OLE links are more commonly inserted via Paste Special or the Insert Object command.
  • {IncludePicture} inserts a non-OLE link to an external picture. Picture links are more commonly inserted via the Insert Picture dialog box by selecting Insert and Link from the Insert button’s drop-down list.
  • {IncludeText} inserts a non-OLE link to an external text file. Text links are more commonly inserted via the Insert Text from File command by selecting Insert as Link from the Insert button’s drop-down list.

The following fields insert numbering codes:

  • {NoteRef} inserts the number of a footnote or endnote. These numbers are automatically updated as content changes in the document. These are normally placed via footnote and endnote insertion.
  • {PageRef} inserts the page number on which the specified bookmark appears. This code is inserted when you create a cross-reference that refers to a page number.

And these fields insert text strings of various types:

  • {Quote} inserts a literal text string that you specify. For example, {Quote "Hello world"} displays the text Hello world.
  • {Ref} inserts text marked by a bookmark. You learned about this one in Chapter 15, in the section “Inserting a Cross-Reference to a Bookmark.”
  • {StyleRef} inserts the text from a paragraph that has the specified style applied. For example, if you have the title of your document set up with a style called DocTitle, the field { StyleRef DocTitle } inserts that title later in the document.

There are also two AutoText-related fields:

  • {AutoText} inserts the specified AutoText entry as an updatable link. This is different from inserting AutoText items from the Building Blocks feature, as in “Working with Building Blocks” in Chapter 2, “Typing and Editing Text,” because the latter inserts an unlinked and nonupdatable copy.
  • {AutoTextList} creates a shortcut menu based on AutoText entries in the active template. You specify some placeholder text to appear in the field. When the user right-clicks the field, a pop-up list appears with AutoText entries to choose from to fill in that field.

Document Automation Fields

The document automation fields are used to set up code strings that automate processes in the document. Some programmers prefer to use document automation fields rather than VBA for some basic automation tasks such as filling in a form with user information or determining whether one value equals another. Here are a few simple examples.

The {Compare} field compares two values and returns a 1 if the comparison is true or 0 if it is false. It is a programming construct, useful for setting up logical conditions. For example, you might count the number of words in the document with the {NumWords} field and then compare that value to 1000:

{ Compare { NumWords } >= 1000 }

This {Compare} field returns a 1 if the word count is 1000 or above; otherwise, it returns a 0.

The 1 and 0 are all well and good, but it might be nicer to show some meaningful text based on the condition. For that, you need an {If} field. Here’s an {If} field’s syntax:

Expression1 Operator Expression2 TextTrue TextFalse

Suppose, for example, that if {NumWords} is at least 1000, you want to print “OK” in the document; otherwise, you want to print “Need More Words”. Here’s the {If} field to accomplish that:

{ IF { NumWords } >= 1000 "OK" "Need More Words" }

Here are the other available document automation fields:

  • {DocVariable} inserts the value of a VBA Word document variable. (This is not the same as the document’s properties, which you can insert with document information fields covered previously in this chapter.)
  • {GoToButton} inserts a button that, when clicked, jumps the insertion point to a specified bookmarked location.
  • {MacroButton} inserts a button that, when clicked, runs a specified macro.
  • {Print} sends a print instruction to the printer; you can use it to automatically print a document, for example. It is usually combined with some other field, such as {If}, rather than standing alone.

Mail Merge Fields

Chapter 14, “Performing Mail and Data Merges,” covers the Mail Merge feature in Word, which is a robust tool for merging the data from one file or database with a document in another file. Most of the fields involved in mail merging are automatically inserted when you work through the mail merge, or you can insert them using the Rules list on the Mailings tab.

  • {AddressBlock} inserts data pulled from multiple fields to form a standard postal mailing address.
  • {Ask} prompts the user to enter a value to be stored in a bookmark. You can then insert the content of that bookmark anywhere in the document via the {Ref} field.
  • {Compare} compares two values and shows a 1 or 0, depending on whether they match. You learned about this field earlier in the chapter in the “Document Automation Fields” section.
  • {Database} inserts the results of a database query in a Word table.
  • {Fillin} prompts the user to enter a value and then displays it in the field. This is different from {Ask} in that it does not store the value in a bookmark for later reuse.
  • {GreetingLine} inserts a greeting line in a mail merge document. You can optionally use the \e switch to specify what name to use if the name is blank. For example, you might want something like Dear Valued Customer.
  • {If} prescribes two different actions to take based on the outcome of a logical test. This is like {Compare} except you can specify the output in each situation rather than accepting the default 1 and 0 outputs.
  • {MergeField} inserts a mail merge field. It requires a field name property, like this: {MergeField FirstName}.
  • {MergeRec} numbers each merged record in a mail merge. If a filter excludes any records, they are still numbered, and the numbered records have gaps in the numbering.
  • {MergeSeq} also numbers each merged record in a mail merge, but it does not number records excluded by a filter.
  • {Next} goes to the next record.
  • {NextIf} goes to the next record in a mail merge only if a condition is met.
  • {Set} assigns new text to a bookmark.
  • {SkipIf} skips the next record in a mail merge only if a condition is met. It is the opposite of {NextIf}.
  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020