ACC: Word Merge Field Names Differ from Query Names in Microsoft Access (167062)



The information in this article applies to:

  • Microsoft Access for Windows 95 7.0
  • Microsoft Access 97
  • Microsoft Word 97 for Windows
  • Microsoft Word for Windows 95
  • Microsoft Word for Windows 95 7.0a

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.

MORE INFORMATION

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.
  3. Add the CompanyName field to the Field row twice.
  4. 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 (:).
  5. Save and run the query. Note that the new names for the CompanyName fields are not displayed.
  6. Close the query.
  7. 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).
  8. In the Microsoft Word Mail Merge Wizard box, click "Create a new document and then link the data to it," and then click OK.
  9. 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.

REFERENCES

For more information about renaming fields in queries, search the Microsoft Access Help Index for "renaming fields," and then "change a field name in a table," or ask the Microsoft Access 97 Office Assistant.

Modification Type:MinorLast Reviewed:8/18/2005
Keywords:kbinterop kbprb KB167062