 |
 |
 |
 |
4.0
Word
Processing
Package |
 |
 |
 |
 |
 |
|
 |
 |
4.12.3 Creating a Data
Source
4.12.3.1 Create and
attach a data source
A data source is a file that contains the data that varies
in each copy of a merged document. For example, a data source can include the
name and address of each recipient of a form letter.
You can think of a data source as a simple table. Each
column in the data source corresponds to a category of information, or data
field—for example, first name, last name, street address, and postal code. The
name of each data field is listed in the first row of cells, which is called
the header record. Each subsequent row contains one data record, which is a
complete set of related information—for example, the name and address of a
single recipient.
What types of data sources can I use?
You can use just about any type of data source you want,
including a Microsoft Word table, Microsoft Outlook contact list, Microsoft
Excel worksheet, Microsoft Access database, or text file:
If you haven't already stored information in a data source,
the Mail Merge Helper guides you step by step through setting up a Word table
that contains your names, addresses, and other data. A Word table works well if
you have a simple list of data (63 or fewer data fields). If your Word data
source contains more than 63 data fields, you must instead set up a delimited
text file.
If you want to use another Microsoft Office program
(Excel, Access, or Outlook) to create a data source, see tips on deciding which
Office program to use. See also using a Microsoft Access database as a data
source.
If you want to use a tab- or comma-delimited text
file as a data source, learn about setting up a delimited text file.
If you want to use another file type as a data
source, see a complete list of the file types you can use.
Planning a data source
Before you create a data source, think about the
following questions:
1.
Will some
data records include more information than others? For example, some data records may have a business name, a
department title, and up to three lines for the address. Other data records may
have only a name, a one-line street address, and a third line with the city,
state, and postal code. In the data source, however, each data record must have
the same number of data fields. Therefore, you need to design the data source
so that it has enough data fields to correspond to the data record with the
most fields. If a data record doesn't have a particular category of
information, you can leave the field blank for that record.
-
Do you plan to sort the
data? If so, you need to set up
the data fields so that you can sort by the field you want. For example,
use separate data fields for the addressee's title, first name, last name,
city, state, and postal code.
3.
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, use separate data fields for
the addressee's postal code and the delivery address (street name and number or
a post office box).
4.
Will you
use information in a data field in different ways or in different types of
merge documents? For example, when
planning addressee information, use separate data fields for the title, first
name, and last name. That way, you can use these fields in different
combinations to print the last name in a mailing label address (Mr. Gerald
LaSalle) and in the salutation of a form letter (Dear Mr. LaSalle) or (Dear
Gerald).
5.
How many
data fields will you have for each data record? You can use the Mail Merge Helper to create a Microsoft Word
data source with up to 63 data fields. If you need more than 63 fields, you can
create the data source as a tab- or comma-delimited text file, or use a
Microsoft Excel worksheet, Microsoft Access database, or other data source.
Organizing an existing data source
If you use the Mail Merge Helper to create a data
source, Word stores the data in a table that contains the proper header record,
field names, and data records. If you create a Word data source without using
the Mail Merge Helper, or if you use an existing data source, you need to
organize the data as follows:
-
Unless you use a separate header source, you must include a
header record as the first record (row of cells) in the data source. Make sure
that there aren't any spaces, text, or blank lines above the header record. In
each cell of the header record, enter data field names of up to 40 characters
each. Header field names must start with a letter, and can include letters,
numbers, or underscore characters (but not spaces). Make sure you don't leave
any header fields blank.
-
Include the same number of data fields (columns) in each
data record as there are field names in the header record. If a record doesn’t
have information for a certain field, you can leave the cell for that field
blank.
Arrange information in each data record in the same
left-to-right order as the corresponding field names in the header record. The
order of columns in the data source is not important, because you can control
where the data is merged into the main document.
Note If
your data source is stored in a tab- or comma-delimited text file, see more
rules for setting up a delimited text file.
Deciding when to use a separate header source
When to use a header source In most cases, you'll probably want to list
the data field names in a separate header record at the beginning of your data
source. However, you may want to include the field names in a separate header
source in the following cases:
1. When you use several data sources. By using a single header
source, you won't have to repeat or change the header record in each data
source, or change the merge field names in the main document.
2. When a data source doesn't contain a header record, or when
field names in the header record don't match the merge field names in the main
document. If you can't add or edit 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 want.
Rules for using a header source
When you use a separate header source, keep the following rules
in mind:
1.
Include the same number of field names in the header source
as there are data fields in the data source.
2.
List the field names in the header source in the same order
as the corresponding information in the data
source.
3.
If both the header source and the data source are stored in
a text file, use the same character (either a tab character () or a comma) to
separate the data fields in the header source and data source.
4.
If you've already inserted merge fields in the main
document, use the same field names in the header source. If the field names and
merge fields don't match, change the field names in the header source or
replace the merge fields in the main document.
4.12.3 Creating, Saving a
data source and Entering Data Records
-
Make sure you've already set up the main document.
-
If you don't see the Mail Merge Helper dialog box, click in
the main document (The document containing the text and graphics that
remain same for each version of document for ex: The return address and
body of the form letter), and then
click Mail Merge on the Tools menu.
-
Under Data source, click Get Data, and then click Create
Data Source.
-
In the Field names in header row box, specify the
data fields that you want to include in the data source:
-
To
delete a data field, click the field name in the Field names in
header row box, and then click Remove
Field Name.
-
To
add a data field, type a new field name in the Field name box, and then
click Add Field Name.
-
To
change the order of the data fields, click a field name in the Field names
in header row box, and
then click one of the arrow buttons.
-
When you finish specifying the data fields, click OK.
-
Locate the folder that you want to save the data source in, type
a file name, and then click Save.
-
Click Edit Data Source.
-
In the Data Form dialog box, fill in the information for each data
record:
-
To
fill in a record, type information for a data field, and then press ENTER to
move to the next field. If you don't want to include information for a
particular field, press ENTER to skip the field. Don't type spaces in the box.
-
To
start a new data record, click Add New.
-
When you finish entering data records, save the data source by
clicking View Source, and then clicking Save on the Standard
toolbar.
-
To return to the main document, click Mail Merge Main Document
on the Database toolbar.
  
|  |
 |
 |
 |
|