ACC: How to Display an AutoLookup Field in Word Mail Merge

ID: Q187685


The information in this article applies to:


SYMPTOMS

Novice: Requires knowledge of the user interface on single-user computers.

When a Microsoft Word Mail Merge document displays AutoLookup fields from a table, the fields do not return the AutoLookup values as expected.


CAUSE

Microsoft Word Mail Merge does not use the RowSource property of the table fields to retrieve the lookup values and retrieves the data values of the fields instead.


RESOLUTION

This example uses the sample database Northwind.mdb to demonstrate how to display the AutoLookup values in a Mail Merge document.

Steps to Prepare for the Mail Merge


  1. Open the sample database Northwind.mdb, and then open the Orders table in Design view.


  2. Select the CustomerID field and, on the Lookup tab, examine the RowSource value. Note that AutoLookup uses the CustomerName field from the Customer table for its lookup value. This reference will be used in step 9.


  3. Select the EmployeeID field and, on the Lookup tab, examine the RowSource value. Note that AutoLookup concatenates the LastName and FirstName values from the Employee table for its lookup value. This references will be used in step 10.


  4. In the Database window, click the Queries tab, and then click New.


  5. In the New Query dialog box, select Design View, and then click OK.


  6. In the Show Table dialog box, select Employees, and then click Add.


  7. Repeat step 6 for the Orders table and the Customers table, and then click Close.


  8. Add all the fields except the CustomerID and EmployeeID fields from the Orders table to the query design grid.


  9. Add the CompanyName field from the Customers table to the query design grid.


  10. Add the LastName and FirstName fields from the Employees table to the query design grid


  11. Save and close the query.


Running the Mail Merge


  1. In the Database window, select the query that you created in the "Steps to Prepare for the Mail Merge" section.


  2. On the Tools menu, click OfficeLinks. In Microsoft Access 7.0, click Merge It. In Microsoft Access 97, click Merge It With MS Word.


  3. In the Microsoft Mail Merge Wizard dialog box, click to select "Create a new document and then link the data to it," and then click OK.

    Note that Microsoft Word starts and that a new, blank document is created.


  4. In Word, click the Insert Merge Field button. Note that a list of all the fields in the Orders table, the CompanyName field from the Company table, and the LastName and FirstName fields from the Employees table is displayed. Select CompanyName from the list, and then press ENTER.


  5. Click the Insert Merge Field button, select LastName from the list, and then press COMMA+SPACEBAR (, ).


  6. Click the Insert Merge Field button, select FirstName from the List, and press ENTER.


  7. Click the View Merged Data button.

    Note that the data presented in the Mail Merge are the same AutoLookup field values that are displayed in the Orders table.



MORE INFORMATION

Steps to Reproduce Behavior

The following example demonstrates what will occur when you include an AutoLookup field from a table in a Mail Merge document.
  1. Open the sample database Northwind.mdb and select the Orders table in the Database window.


  2. On the Tools menu, click OfficeLinks. In Microsoft Access 95, click Merge It. In Microsoft Access 97 click Merge It With MS Word.


  3. In the Microsoft Mail Merge Wizard dialog box, click to select "Create a new document and then link the data to it," and then click OK.

    Note that Microsoft Word starts and that a new, blank document is created.


  4. In Word, click the Insert Merge Field button. Note that a list of all the fields in the Orders table is displayed. Select CustomerID from the list and press ENTER.


  5. Click the Insert Merge Field button and select EmployeeID from the list.


  6. Click the View Merged Data button.

    Note that the data presented in the Mail Merge is not the AutoLookup field values but is rather the actual EmployeeID and CustomerID values.



REFERENCES

For more information about AutoLookup fields, search the Help Index for "Create a field that looks up or lists values in tables."


Keywords          : kbdta TblDatyp 
Version           : WINDOWS:7.0,97
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: April 29, 1999