Microsoft KB Archive/167062

= ACC: Word Merge Field Names Differ from Query Names in Microsoft Access =

Article ID: 167062

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition
 * Microsoft Word 97 Standard Edition
 * Microsoft Word 95 Standard Edition
 * Microsoft Word 95a

-



This article was previously published under Q167062



Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
When you export a query to Microsoft Word that contains field names which have been renamed in the query, the field names that are exported to Microsoft Word are different from the field names that are displayed in the query.



CAUSE
This behavior occurs when the Caption property of the fields in the table contain a value.



RESOLUTION
To have Microsoft Access and Microsoft Word display the same names for the fields, remove the Caption property values that you have set for the fields in the table. Then, the new names you have given the fields will be displayed in both the query and in Microsoft Word.



Steps to Reproduce Behavior

 * 1) Open the sample database Northwind.mdb.
 * 2) Create a new query based on the Customers table.

NOTE: The Caption property is set to Company Name in the Customers table.
 * 1) Add the CompanyName field to the Field row twice.
 * 2) Rename the first CompanyName field as Cust A and the second CompanyName field as Cust B.

NOTE: To rename a field in a query, place the insertion point in front of the first letter of the field name in the query Design grid, and type a new name for the field followed by a colon.
 * 1) Save and run the query. Note that the new names for the CompanyName fields are not displayed.
 * 2) Close the query.
 * 3) In the Database window, select the query, and on the Tools menu, point to Office Links, and then click "Merge It with MS Word" (or "Merge it" in Microsoft Access 7.0).
 * 4) In the Microsoft Word Mail Merge Wizard box, click "Create a new document and then link the data to it," and then click OK.
 * 5) When Microsoft Word starts, click the Insert Merge Field button. Note that Microsoft Word shows the new field names even though Microsoft Access does not.

