The information in this article applies to:
SUMMARYThis article describes how to create a link in Word for Windows to a Microsoft Access query. You can link a Microsoft Access query or table to your Word document, but you cannot link a Microsoft Access form or report. MORE INFORMATIONMicrosoft Word for Windows 2.x and Microsoft Access 1.xMicrosoft Access copies a query to the Clipboard in unformatted text format; so, when you link a Microsoft Access query to your Word document, it appears in tab-delimited text format.An automatic link to a Microsoft Access query will not be updated. After you create an automatic link, you must change it to a manual link using the Links command on the Edit menu. Then you can use the Links Update command (on the Edit menu) or press F9 to update the Access information. For more information on editing and updating links, see pages 686-690 in the Word for Windows, version 2.0, "User's Guide." It is only possible to link an entire Microsoft Access query in a client application. It is not possible to link a portion of a Microsoft Access query to your Word document. If you copy part of the Microsoft Access query to link to your Word document, the Paste Link button is unavailable, and the Source is Unknown in the Paste Special dialog box in Word. NOTESIn Word versions 6.0 and 7.0 and Microsoft Access versions 2.0 and 7.0, the DDEAUTO field won't change to DDE after you click the Edit Links command and select Manual. You have to edit the field and remove AUTO.In Word 7.0 and Microsoft Access 7.0, by default the DDEAUTO field is inserted with an \r switch instead of the \t switch. The \r switch prevents user from changing the specified item, like changing "All" to "Data." If you do change an item to "Data," you will receive the "Word Cannot Obtain Data from ....." error message. Remove the \r and it will work properly like Word 6.0. Also, in Word 6.0, the \t for unformatted text is included by default; in Word 7.0 unformatted text is pasted as formatted text. Creating the Link
The above steps create a DDEAUTO field in the document that can be displayed by turning on Field Codes from the View menu. The DDEAUTO field will appear as follows: {DDEAUTO MSAccess "database.mdb;QUERY queryname" All \* mergeformat \t} To change the link to manual so that it will be updated correctly, from the Edit menu choose Links, select the desired link, and then choose Manual under Update. This will change the DDEAUTO field to a DDE field that can be manually updated by pressing the F9 key. This field can also be created manually by typing in the above field code (press CTRL+F9 to create the field brackets) and then pressing F9 to update the field and establish the link. The database must be open to successfully create and update the link. The DDE field linking a Microsoft Access query can also be edited to specify different items in the query. "All" is the item requested by default when copying and pasting the query in the above example. However, the following items can be used in the place of "All" in the DDEAUTO fieldcode to link different items in the query:
For example, the following field creates a link to the field names in
the Customer List query in NWIND.MDB database:
{DDE MSAccess "C:\\ACCESS\\NWIND.MDB;Query Customer List" FieldNames mergeformat \t} REFERENCESWord for Windows "User's Guide," version 2.0, pages 686-690 Additional query words: 2.0 2.0a 2.0a-cd 2.0b 2.0c 2.0c-cd, 6.0, 6.0a, 6.0c, 7.0, 7.0a winword2 winword
Keywords : |
Last Reviewed: December 22, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |