Microsoft KB Archive/212322

= HOW TO: Design and Set Up Mail Merge Data in Microsoft Word 2000 =

Article ID: 212322

Article Last Modified on 10/27/2002

-

APPLIES TO


 * Microsoft Word 2000 Standard Edition

-



This article was previously published under Q212322



IN THIS TASK
SUMMARY
 * How to Plan and Organize Your Data Source
 * How to Organize Data in Tables or Paragraphs
 * How to Design a Data Source That Contains Many Fields
 * How to Decide When to Use a Separate Header Source
 * How to Design a Header Source
 * How to Use a Header Record from Another Data Source
 * Types of Data That You Can Use with Mail Merge
 * Types of Data That You Cannot Use with Mail Merge

REFERENCES



SUMMARY
This article explains the acceptable format for a mail-merge data source in Microsoft Word 2000, and offers suggestions and questions that are helpful to ask yourself as you create a data source.

The easiest data source format to work with is a Word table. However, you can use any database-like format, such as a text file in which fields are separated by commas or tabs, and records are separated by paragraph marks.

In a data source, each category of information, such as Last Name, is called a field. The set of fields that make up information about one person is called a record.

back to the top

How to Plan and Organize Your Data Source
Before you create a data source, decide what information you want to include and how you want to use that information, and then design the database. In the long run, this saves you time and work. Ask yourself the following questions as you prepare your data source:  Will some records have more information than others?

Some of your data records may have more information than other records. For example, some entries may have a business name, a department title, and up to three lines for the address. Other entries may have only a name, a one-line street address, and a third line with the city, state, and ZIP Code.

In the data source, however, each data record must have the same number of data fields. Design the data source so that it has enough data fields to correspond to the record with the most fields. You do not need to fill in every field in the data record; you can leave some fields blank. Word automatically suppresses blank records. Do you plan to sort the data?

If you intend to sort your data, you need to arrange it so that you can sort the data based on some criteria. For example, the city, state, and ZIP Code are usually printed on the same line of a mailing label, so you might want to include all of this information in the same field. However, if you do this, you cannot sort your records based on the state or the ZIP Code. If you want to be able to sort based on individual address elements, you should separate each piece of information into a separate field.

The same is true if you want to sort your data by the addressees' last names. In this case, you need to separate the last names and the first names into separate fields. Do you want to use a POSTNET bar code?

To speed mail delivery in the United States, you can print a POSTNET bar code on mailing labels and envelopes. To use the bar code, both the addressee's ZIP Code and the delivery address (street name and number or post office box) must be in their own data fields, separate from all other parts of the address. Will you use information in a particular field in different ways?

In a form letter, the first line of the inside address usually contains a title and the recipient's complete name -- for example, Mr. Gerard LaSalle. The salutation, on the other hand, might contain only the title and last name (Dear Mr. LaSalle) or only the first name (Dear Gerard). If you place the title, first name, and last name in separate fields, you can use the same field to print the last name in both the address and the salutation. Alternatively, you can use one field for the complete title and name in the inside address, and a second field for the title and last name in the salutation. Will you use the data source for several merge documents?

You can merge a single data source with any type and number of main documents. If you want to set up a data source for printing form letters, plan the addressee information so that you can use the same data source to print the addresses on mailing labels or envelopes. How many fields (pieces of information) do you have for each record (the collection of the pieces of information)?

If you have a few pieces of information for each record, you can use the Mail Merge Helper (on the Tools menu) in Word.

There is a limitation of 63 fields in the Mail Merge Helper. If your number of fields exceeds this value, do not use the Mail Merge Helper. Instead, use one of the following:

 Use Microsoft Excel as your data source. The maximum number of data fields in an Excel worksheet is 256.</li> Use a Microsoft Access database as your data source.</li> Use a tab-delimited text file or a comma-delimited text file as your data source.</li></ul>

Mail-merge performance degrades as the number of fields in the header row increases. The configuration of your computer and the available memory may also limit the number of fields that you can insert in your data document.

The header record (row) cannot contain any spaces. Each header field is limited to 40 characters and must start with a letter. Each subsequent character must be a letter, a number, or the underscore character. All header fields must be filled in.

For more information about limits for Word, click Microsoft Word Help on the Help menu, type limits for Word in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

</li></ul>

back to the top

How to Organize Data in Tables or Paragraphs
When you create a data source through the Mail Merge Helper, Word sets up the data source in a table. The table contains a column for each field name that you specify in the Create Data Source dialog box. The first row of the table is your header row; each subsequent row contains the information for one data record.

Although text might wrap in each cell, it will be printed correctly. If you use an existing data source or set up the data source in Word without using the Mail Merge Helper, you need to organize the data as follows:
 * Unless you use a separate header source, make sure that the header record is the first record (row of cells) in the data source. Make sure that there are no spaces, text, or blank lines before the header record. The header record cannot contain any spaces. Each header field is limited to 40 characters and must start with a letter. Each subsequent character must be a letter, a number, or the underscore character. All header fields must be filled in.
 * Make sure that each data record has the same number of data fields as there are field names in the header record. If a record does not have information for a certain field, leave the cell for that field blank.
 * Arrange information in the data records in the same order, left to right, as the corresponding field names in the header record. The order of your columns in the data source is not important because you will control the placement of your data in the mail merge main document.

back to the top

How to Design a Data Source That Contains Many Fields
The Mail Merge Helper creates a table for the data file. In Word 2000, the maximum number of fields (table columns) is 63.

If you need more data fields in your data source, Word cannot organize the data in a table. Instead, you can arrange your information as separate paragraphs in a Word document. The header record and each data record must end with a paragraph mark, which is the data record delimiter. Each field name in the header record and each field in the data record must be separated by a tab character or comma, which is the data field delimiter. If any of the data fields are empty, you need to include a field delimiter to identify the empty field.

If you are using a data source from a database or spreadsheet program, you can export this data to an ASCII text format, separated by commas or tabs, or you may be able to attach the database by using Open Database Connectivity (ODBC), Dynamic Data Exchange (DDE), or a converter. If you export your data to an ASCII format and Word does not automatically recognize the field and record delimiters, Word prompts you to select the delimiters when you first use the data source. When you set up a data source in this format in Word, you should use a paragraph mark as the data record delimiter and a tab character or comma as the data field delimiter.

In addition to the general rules for organizing a data source, the following rules also apply to data sources set up as regular text:
 * Press ENTER to end each data record with a paragraph mark. Make sure that there are no extra paragraph marks between or following the data records. Word interprets any empty paragraphs (blank lines) as empty records.
 * Use the same field delimiter in both the header record and the data record. For example, you cannot use tab characters in the header record and commas in the data records. Because text in data fields may include commas, it is better to use tab characters.
 * If a data record does not include information for a specific data field, insert two tab characters or two commas to indicate the empty field. Do not insert a second field delimiter if the data field is the last one in the data record.
 * Enclose the data field in quotation marks if the data field contains any one of the following characters:
 * A tab character or comma, if you are using that same character to separate the fields.
 * A line break or a paragraph mark.
 * A character that you specified as the list separator character in Regional and Language Options in Control Panel.
 * If information in a data field contains quotation marks (" "), type the characters twice ("" ""). When information from the data field is merged, only one pair of quotation marks will be printed.

back to the top

How to Decide When to Use a Separate Header Source
In most cases, it is convenient to list the field name for each data field in the first row, or record, of the data source. However, you may want to list the field names in a separate header source for the following reasons:
 * You can use the same header row and field names to merge data from various sources without having to repeat or change the header row in each data source or change the merge field names in the main document.
 * Sometimes a data source from another program does not include a header record, or field names in the header record do not match the merge field names in your main document. If you cannot modify or add a header record in the data source, for example, because the data source is read-only, you can use a separate header source that contains the field names you specify.

If you use a separate header source, you must specify both the header source and the data source before you can merge the main document with the data source.

back to the top

How to Design a Header Source
When you specify a header source, keep the following rules in mind:
 * The header source must contain the same number of field names as there are data fields in the data source.
 * Field names in the header source must be listed in the same order as the corresponding information in the data source.
 * Use the same field delimiter (either a tab character or a comma) for both the header source and the data source.
 * If your main document already contains merge fields, use the same merge fields in your header source. If you do not, you need to replace the merge fields in the main document to match the field names in the header source. After you specify a header source, you can edit it just as you do the data source.

back to the top

How to Use a Header Record from Another Data Source
If you have a data source that contains a header record, you can use it as a header source. For example, if you have broken up your data source into several documents, you can specify the field names in the header record of the first data source. When you merge from other data sources that do not have a header record, specify the first data source as the header source. Then specify each of the remaining data sources in turn.

Word ignores the data records from the first data source and uses only the header record.

back to the top

Types of Data That You Can Use with Mail Merge
You can merge virtually any type of information from a mail merge data source, including:
 * Any text or numbers.
 * Graphics for which a graphics filter is installed.For more information about graphics filters that come with Word, click Microsoft Word Help on the Help menu, type Graphics file types Word can use in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

For more information about how to install graphics filters and file converters, click Microsoft Word Help on the Help menu, type Install or remove individual components in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

NOTE: If the graphics are contained in a data source from a program other than Word, you must convert the file by using a file format converter.


 * Objects created in programs that support object linking and embedding (OLE), such as Equation Editor.
 * Word fields that display a result, such as an {=} (Formula) field.

To add information other than text or numbers to a data source that you created in Word, you must display the data source in a document window. To do this, click the View Source button in the Data Form dialog box. You can also click Open on the File menu to open a Word data source. Then insert the information in the appropriate column and row of the data source table.

back to the top

Types of Data That You Cannot Use With Mail Merge
You cannot merge text or graphics contained in a frame in the data source. However, you can position merge fields inside frames. When you merge the documents, the text and graphics from the data source are positioned in the frame.

back to the top

<div class="references_section">