How to create a form letter by using information from an Access database in Word 2002

Article translations Article translations
Article ID: 318115 - View products that this article applies to.
This article was previously published under Q318115
Expand all | Collapse all

On This Page

SUMMARY

This article explains how to use the Mail Merge feature in Microsoft Word 2002 to create and print form letters that call data from a Microsoft Access database. This article contains instructions about using the Customers table in the Northwind sample database that is supplied with Access.

When you use the Word 2002 Mail Merge feature, Word merges a main document with a recipient list (data file) to generate a set of output documents (form letters):
  • The main document contains the basic text that is the same in all of the output documents. It may contain a letterhead, text, and instructions within merge fields for inserting text (such as recipient names and addresses) that varies from one output document to another.
  • The recipient list is a database -- for example, an Access 2002 database file, that contains the data that is to be merged into the output documents. This database is typically a list of names, addresses, phone numbers, and other variables.
  • The output documents are the result of the mail-merge operation. The text in an output document can be the same in all output documents, but you can apply formatting to specific documents.

Step 1 - Prepare the Access Database

Before you proceed with the Mail Merge Wizard, decide how you want to use your Access database for the form letter in Word 2002. There are several methods that you can use:

Use an Access Table or Query in a Word Document

You can use an Access table or query directly from within a mail-merge operation in Word, without making any additional modifications to the table or query.

To use an Access query or table as a Word data source, continue with the steps outlined in the Step 2 - Set Up the Main Document section of this article.

Export an Access Table or Query Directly into a Word Document

You can use Access to embed data from an Access table or query directly into a Word document. To embed data from an Access database in a Word document, follow these steps:
  1. Open your database, and then select the table or query that contains the data that you want to embed in a Word document.
  2. On the Tools menu, click Office Links, and then click Merge It With MS Word (or click Merge It With MS Word on the Office Links toolbar).

    The Microsoft Word Mail Merge Wizard starts.
  3. Select the Link your data to an existing Microsoft Word document or Create a new document and then link your data to it option. If you select Link to an existing Microsoft Word document, the wizard will ask for the document location. When you finish, click OK.
  4. The wizard starts Word and then activates a mail merge link to your table or query.

    Proceed to the Step 2 - Set Up the Main Document section of this article.

Export Your Data from Access as a Word Data Source

To export and use your data from Access as a Word data source, follow these steps:
  1. In Access, open your database table or query.
  2. On the File menu, click Export.
  3. In the Export Table or Export Query dialog box, follow these steps:
    1. In the Save as type box, click Microsoft Word Merge (*.txt).
    2. In the File name box, type a name for your exported file.
    3. In the Save in box, click the folder in which you want to save the file.
  4. Click Export All.

    Access now exports your table or query result as a tab-delimited text file.
  5. Close your database, and then quit Access. Continue with the steps outlined in the Step 2 - Set Up the Main Document section of this article. When you reach the Step 3 - Specify the Microsoft Access Data Source section of this article, select the exported tab-delimited text file to continue your Word mail-merge operation.

Copy and Paste Access Data as a Word Data Source

To copy, paste, and use Access data as a Word data source, follow these steps:
  1. Open your Access database table or query.
  2. On the Edit menu, click Select All Records.
  3. On the Edit menu, click Copy.
  4. Open a new, blank document in Word.
  5. Use one of the following methods.
  • Method 1: Save Data as a Table
    1. On the Edit menu, click Paste Special. In the Paste Special dialog box, click Formatted Text (RTF) under As.

      The information from your Access table or query is pasted into a Word table.
    2. Save this new file as a Word document.

      This new file is your new Word data source.
    3. Continue with the steps outlined in the Step 2 - Set Up the Main Document section of this article. When you reach the Step 3 - Specify the Access Data Source section of this article, select the Word document to continue your Word mail-merge operation.
  • Method 2: Save Data in Tab-Delimited Format
    1. On the Edit menu, click Paste Special.
    2. In the Paste Special dialog box, click Unformatted Text, and then click OK.

      The information from your Access table or query is pasted into your Word document as tab-delimited text.
    3. On the File menu, click Save As.
    4. In the Save As dialog box, click Plain Text in the Save as type box.
    5. In the File name box, type a name for your exported file.
    6. In the Save in box, select the folder in which you want to save the file, and then click Save.
    7. Under Text encoding, click Windows (Default).
    8. Close your Word data source document.
    9. Continue with the steps outlined in the Step 2 - Set Up the Main Document section of this article. When you reach the Step 3 - Specify the Access Data Source section of this article, select the tab-delimited text file that contains your table file to continue your Word mail-merge operation.

Step 2 - Set Up the Main Document

  1. Start Word 2002, point to Letters and Mailings on the Tools menu, and then click Mail Merge Wizard.
  2. Under Select document type, click Letters.

    The active document becomes the main document (the document that contains the text and graphics that are the same for each version of the merged document -- for example, the return address or salutation in a form letter).
  3. Click Next: Starting document.
  4. Do one of the following:
    • Start with the document currently shown in the document window. To do this, click Use the current document.

      You can then either type the letter in the document window or wait until the wizard prompts you to do so in a later step.
    • Start with a template.
      1. Click Start from a template.
      2. Click Select template.
      3. In the Select Template dialog box, click the Mail Merge tab, select the template that you want, and then click OK.
    • Start with an existing document.
      1. Click Start from existing document.
      2. In the Start from existing box, select the document that you want, and then click Open.
      3. If you do not see the document, click More files, and then click Open. In the Open dialog box, locate the document that you want, and then click Open.
  5. Click Next: Select recipients.

Step 3 - Specify the Access Data Source

  1. Under Select recipients, click Use an existing list.
  2. Click Browse. By default, Word opens the My Data Sources folder.
  3. In the Select Data Source dialog box, locate and then select the file that you want to use. For this example, you can use the Customers table in the Northwind Sample database that is included with Access. By default, the Northwind Sample database is installed in the following location:
    C:\Program Files\Microsoft Office\Office10\Samples\Northwind.mdb
  4. In the Select Table dialog box, select the table or query that you want to use. For this example, select the Customers table, and then click Open.
  5. All of the entries in the data source appear in the Mail Merge Recipients dialog box, where you can refine the list of recipients to include in the merge.
NOTE: You can use Microsoft Query to create a query and retrieve the data that you want from an Access database. You can create a simple query by using the Query Wizard, or you can create a more complex query by using the advanced features of Microsoft Query.

For example, if you want to insert database information, display the Database toolbar, click Insert Database, and then click Get Data. In the Select Data Source dialog box, click MS Query on the Tools menu.

When Microsoft Query starts, the Microsoft Office Assistant provides help in constructing your query.

If you do not see the Office Assistant in Microsoft Query, close the Choose Data Source dialog box, and then click Microsoft Query Help on the Help menu.

Step 4 - Select the Recipients

  1. In the Mail Merge Recipients dialog box, select the recipients that you want to include. To do this, use any of the following methods:
    • Use the check boxes to designate recipients.

      This method is most useful if your list is short. Click to select the check boxes next to the recipients that you want to include, and then click to clear the check boxes next to the recipients that you want to exclude.

      NOTE: If you know that you want to include most of the list in your merge, click Select All, and then clear particular records. Similarly, if you want to include only a few records in the list, click Clear All, and then select the records that you want.
    • Sort items in the list.

      This is useful if you want to see items in alphabetical or numeric order. Click the column heading of the item that you want to sort by. For example, if you want to display the list alphabetically by last name, click the Last Name column heading.
    • Filter items in the list.

      This is useful if the list contains records that you know you do not want to see or include in the merge. After you have filtered the list, you can use the check boxes to include and exclude records, as described in the previous method. To filter the list, follow these steps:
      1. Click the arrow next to the column heading of the item that you want to filter by.
      2. Click any of the following:
        • (Blanks) displays all the records in which the corresponding field is blank.
        • (Nonblanks) displays all the records in which the corresponding field contains information.
        • If your data source contains records that share the same information, and there are 10 or fewer unique values in the column, you can filter by specific information. For example, if there are multiple addresses that list Australia as the country or region, you can filter on Australia.
    • The Mail Merge Recipients dialog box displays only the designated records. To display all the records again, click (All).
    NOTES:
    • For advanced sorting and filtering, click the arrow next to any column name, and then click (Advanced). Use the Filter Records and Sort Records tabs to set up the sorting or filtering query that you want.
    • If you have installed address-validation software, you can click Validate in the Mail Merge Recipients dialog box to validate your recipients' addresses.
  2. For this example, click Clear All, and then select the first two customers on the list.
  3. Click OK to return to the Mail Merge Wizard.

    Word will use the recipients that you designated for the merge.
  4. Click Next: Write your letter.

Step 5 - Complete the Letter and Add Merge Fields

If you have not already done so, in the main document, type the text that you want to appear in every form letter.

Insert Merge Fields

Insert merge fields where you want to merge names, addresses, and other information from the data source. To insert merge fields, follow these steps:
  1. In the main document, click where you want to insert the field.
  2. Insert any of the following:
    • Address block with name, address, and other information
      1. Click Address block.
      2. In the Insert Address Block dialog box, select the address elements that you want to include and the formats that you want, and then click OK.

        For help on an option, click the question mark, and then click the option.
      3. If the Match Fields dialog box appears, Word may not be able to find some of the information it needs for the address block. Click the arrow next to (not available), and then select the field from your data source that corresponds to the field required for the mail merge.
    • Greeting line
      1. Click Greeting line.
      2. Select the greeting line format, which includes the salutation, name format, and following punctuation.
      3. Select the text that you want to appear in cases where Word cannot interpret the recipient's name -- for example, when the data source contains no first or last name for a recipient, but only a company name.
      4. Click OK.
      5. If the Match Fields dialog box appears, Word may not be able to find some of the information it needs for the greeting line. Click the arrow next to (not available), and then select the field from your data source that corresponds to the field required for the mail merge.
    • Other fields of information
      1. Click More items.
      2. Do one of the following:
        • To select from address fields that will automatically map to corresponding fields in your data source, even if the data source's fields do not have the same name as your fields, click Address Fields.
        • To select from fields that always take data directly from a column in a database, click Database Fields.
      3. In the Fields box, click the field that you want.
      4. Click Insert, and then click Close.
      5. If the Match Fields dialog box appears, Word may not be able to find some of the information it needs to insert the field. Click the arrow next to (not available), and then select the field from your data source that corresponds to the field required for the mail merge.

        Note: If you insert a field from the Database Fields list, and then later switch to a data source that does not have a column with the same name, Word cannot insert that field information into the merged document.
    • Electronic postage

      To add electronic postage, you must first install an electronic postage program, such as one you purchased from a service on the Web. To use electronic postage, follow these steps:
      1. Click Electronic postage.

        If you do not have an electronic postage program installed, Word prompts you to install one if you want.
      2. Insert the postage according to the program's instructions.
    • Postal bar code

      You must select a letter or envelope type that supports the POSTNET bar code. To use the Postal bar code, follow these steps:
      1. Click Postal bar code.
      2. In the Insert Postal Bar Code dialog box, select the appropriate address fields.

        NOTE: The Postal bar code option appears only if you are using the U.S. language version of Word.
      3. Repeat steps a and b for all the fields that you want to insert.NOTES:
        • You cannot type merge field characters ({ }) by using the "{" or "}" keys or insert them by using the Symbol command on the Insert menu.
        • If the merge fields appear inside braces, such as { MERGEFIELD City }, Word is displaying field codes instead of field results. This does not affect the merge operation, but if you want to display the results instead, right-click the field code, and then click Toggle Field Codes on the shortcut menu.
      For this example, insert the AddressBlock and GreetingLine fields and text, so that your first page appears similar to the following:
      February 26, 2002

      <<AddressBlock>>



      <<GreetingLine>>



      Type your letter here.



      Sincerely,

      Type your name here


    NOTE: You can also use the Mail Merge toolbar to insert merge fields, work with your mail merge main document, or to run a mail merge. To display the Mail Merge toolbar, point to Letters And Mailings on the Tools menu, and then click Show Mail Merge Toolbar. The Mail Merge toolbar provides additional commands not included in the Mail Merge wizard task panes. For example, you can use the Insert Word Field menu on the Mail Merge toolbar to insert Word fields for controlling the merge process (for example, an IF field that inserts text only if a particular merge field has a specified value). Or, you can click Check For Errors to direct Word to run the mail merge and report any errors contained in the main document.

Change the Format of the Merged Data

To format merged data, you have to format the merge fields in the main document. Do not format the data in the data source, because its formatting is not retained when you merge the data into the document. To change the format of the merged data, follow these steps:
  1. In the main document, select the field that contains the information you want to format, including the enclosing merge field characters (<<>>).
  2. On the Format menu, click Font, and then select the options that you want.

Formatting by Using Field Codes

To control other aspects of formatting, press ALT+F9 to display field codes, and then add switches to the merge fields. When you are working with fields, a switch is a special instruction that causes a specific action to occur. Generally, a switch is added to a field to modify a result.

For example:
  1. To display the number "34987.89" as $34,987.89, add the Numeric Picture switch (\#).
  2. To print client names in uppercase letters, add the Format switch (\* UPPER).
  3. To make sure that the merged information has the same font and point size that you apply to the merge field, add the (\* MERGEFORMAT) switch.

Step 6 - Saving the Document

After you have completed the main document and inserted all of the merge fields, save the document before proceeding:
  1. On the File menu, click Save As.
  2. Name the document, and then click Save.
  3. Click Next: Preview your letters.

Step 7 - Preview the Letters and Fine-Tune the Recipient List

When the wizard displays the Step 5 Mail Merge task pane, it replaces each of the merge fields in the main document with the actual text from the first entry of the recipient list, so that you can see how your first output document will appear.

For example, if you were to continue using the sample database shown earlier, the first page should appear similar to the following after you click Next: Preview your letters:
February 26, 2002

Alfreds Futterkiste
Obere Str. 57
Berlin 12209

Dear Alfreds Futterkiste,

Type your letter here.

Sincerely,

Type your name here
To preview additional entries, do either of the following:
  • To preview the items in order, click the left or right arrow buttons.

    -or-
  • To locate and preview a specific item, click Find a recipient, and then enter the search criteria in the Find Entry dialog box.
Fine-tune the recipient list, as appropriate to your situation. To do so, use one of the following methods:
  • To exclude a particular recipient from the merge, click Exclude this recipient.

    -or-
  • To change the list of recipients, click Edit recipient list, and then make your changes in the Mail Merge Recipients dialog box.

Step 8 - Complete the Merge

To complete the merge, use any of the following methods.

Personalize Individual Letters

To personalize individual items, you actually complete the merge, and then edit the information that you want in the resulting merged document:
  1. Click Edit individual letters.
  2. In the Merge to New Document dialog box, select the records that you want to merge.
  3. Click OK.

    Word creates and then opens a new merged document. Your main document also remains open, and you can switch back to it if you want to make a change to all the documents.
  4. Scroll to the information that you want to edit, and then make your changes.
  5. Print or save the document just as you would any regular document.

Print the Letters

To print the letters, do either of the following:
  • If you personalized the items, and the merged document is active, follow these steps:
    1. On the File menu, click Print.
    2. Select the options that you want.
  • If you want to print directly from the Mail Merge Wizard, follow these steps:
    1. In step 6 of the Mail Merge Wizard (Complete the merge), click Print.
    2. In the Merge to Printer dialog box, do one of the following, and then click OK:
      • To print all the documents, click All.
      • To print the document that you see in the document window, click Current record.
      • To print a range of documents, click From, and then type the record numbers in the From and To boxes.
    3. In the Print dialog box, select the options that you want.

Save the Merged Letters for Later Use

If you want to edit merged letters or save them for later use, you can collect them into a single document. To do this, follow these steps:
  1. Click Edit individual letters.
  2. In the Merge to a New Document dialog box, do one of the following, and then click OK:
    • To merge all the documents, click All.
    • To merge only the document that you see in the document window, click Current record.
    • To merge a range of documents, click From, and then type the record numbers in the From and To boxes.
    Word opens a single new document that contains all the individual letters. You can then save the document for later use, just as you would any regular document.


REFERENCES

For more information about IF fields, click Microsoft Word Help on the Help menu, type Field Codes: IF field in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

For more information about MERGESEQ fields, click Microsoft Word Help on the Help menu, type Field Codes: MERGESEQ field in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

For more information about SET fields, click Microsoft Word Help on the Help menu, type Field Codes: SET field in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

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

For more information about how to insert a database into your Word document, click Microsoft Word Help on the Help menu, type insert Microsoft Access data into a Word document in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
318117 HOW TO: Use Addresses from an Excel 2002 Worksheet to Create Labels in Word 2002
318112 HOW TO: Use Addresses from an Access 2002 Database Create Labels in Word 2002
294693 WD2002: How to Use Mail Merge to Create a Directory
294688 How To Design and Set Up a Mail Merge Address List in Word 2002
294686 HOW TO: Use Mail Merge to Create a List Sorted by Category in Word 2002
294683 HOW TO: Use Mail Merge to Create Form Letters in Word 2002
290408 WD2002: Frequently Asked Questions About Mail Merge
214183 HOW TO: Use Mail Merge with an Access Parameter Query in Word 2000
212329 How To Use Mail Merge to Create a Form Letter in Word 2000
212322 HOW TO: Design and Set Up Mail Merge Data in Microsoft Word 2000
211190 HOW TO: Use Access 2000 Data in Word 2000

Properties

Article ID: 318115 - Last Review: August 31, 2007 - Revision: 3.7
APPLIES TO
  • Microsoft Word 2002 Standard Edition
  • Microsoft Access 2002 Standard Edition
Keywords: 
kbnewfile kbdatabase kbforms kbhowtomaster kbmerge KB318115

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com