ACC: How to Display an AutoLookup Field in Word Mail Merge
ID: Q187685
|
The information in this article applies to:
-
Microsoft Access versions 7.0, 97
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
- Open the sample database Northwind.mdb, and then open the Orders table
in Design view.
- 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.
- 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.
- In the Database window, click the Queries tab, and then click New.
- In the New Query dialog box, select Design View, and then click OK.
- In the Show Table dialog box, select Employees, and then click Add.
- Repeat step 6 for the Orders table and the Customers table, and then
click Close.
- Add all the fields except the CustomerID and EmployeeID fields from
the Orders table to the query design grid.
- Add the CompanyName field from the Customers table to the query design
grid.
- Add the LastName and FirstName fields from the Employees table to the
query design grid
- Save and close the query.
Running the Mail Merge
- In the Database window, select the query that you created in the
"Steps to Prepare for the Mail Merge" section.
- On the Tools menu, click OfficeLinks. In Microsoft Access 7.0, click
Merge It. In Microsoft Access 97, click Merge It With MS Word.
- 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.
- 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.
- Click the Insert Merge Field button, select LastName from the list,
and then press COMMA+SPACEBAR (, ).
- Click the Insert Merge Field button, select FirstName from the List,
and press ENTER.
- 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.
- Open the sample database Northwind.mdb and select the Orders table in
the Database window.
- On the Tools menu, click OfficeLinks. In Microsoft Access 95, click
Merge It. In Microsoft Access 97 click Merge It With MS Word.
- 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.
- 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.
- Click the Insert Merge Field button and select EmployeeID from the
list.
- 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