HOW TO: Use Access 2000 Data in Word 2000 (211190)



The information in this article applies to:

  • Microsoft Word 2000

This article was previously published under Q211190

SUMMARY

This article explains how to do the following:
  • Use a Microsoft Access query or table as a Microsoft Word 2000 data source.
  • Use Microsoft Query to retrieve Access data as a data source in Word.
  • Export and use your data from Access as a Word data source.
  • Copy, paste, and use Access data as a Word data source.
back to the top

How to Use an Access Query or Table as a Word Data Source

For additional information about how to use an Access parameter query, click the article number below to view the article in the Microsoft Knowledge Base:

214183 WD2000: How to Use Mail Merge with an Access Parameter Query

To use an Access query or table as a Word data source, follow these steps:
  1. If you want to use the results of an Access query or table as your data source in a Word mail merge, follow these steps:
    1. On the Tools menu, click Mail Merge.
    2. In the Mail Merge Helper dialog box, click Get Data, and then click Open Data Source.
    3. Proceed to step 3.
  2. If you want to insert the results of an Access query or table in a Word document, follow these steps:
    1. On the View menu, point to Toolbars, and then click Database.
    2. On the Database toolbar, click Insert Database.
    3. In the Database dialog box, click Get Data.
  3. In the Files of type list in the Open Data Source dialog box, click MS Access Databases.
  4. Select the Access database file that you want to use as a data source.
  5. Select the Select Method check box, and then click Open.
  6. In the Confirm Data Source dialog box, click MS Access Databases via DDE (*.mdb;*.mde), and then click OK.

    NOTE: If MS Access Databases via DDE (*.mdb;*mde) is not available, you need to remove and then reinstall Access.
  7. In the Microsoft Access dialog box, click the Queries tab or the Tables tab.
  8. Select the query or table that you want to use, and then click OK.

    NOTE: On the Queries tab, the Link to Query check box is selected by default. This option creates a link to the Access database query. Select this check box to always retrieve the most up-to-date version of any of the listed queries. To ignore changes to the original query instructions, clear the Link to Query check box.
  9. Word returns the results of your Access query or table to your Word document. Do one of the following, depending on whether you are performing a mail merge or just inserting a database:
    1. If you are using the Mail Merge feature, Word prompts you with the following message:

      Word found no merge fields in your main document. Choose the Edit Main Document button to insert merge fields into your main document.

      Click Edit Main Document to insert merge fields into your main document.
    2. If you are inserting database information, click Insert Data in the Database dialog box. In the Insert Data dialog box, either click All to insert all of the results of the Access query into your Word document, or click From, and then specify the records that you want to insert into your Word document.

      NOTE: In the Insert Data dialog box, the Insert data as field check box is not selected by default. If selected, this option inserts the data into the table as a field. Select this check box if you want to update the data in your Word document whenever the data source changes.
back to the top

How to Use Microsoft Query to Retrieve Access Data as a Data Source in Word

To use Microsoft Query to retrieve Access data as a data source in Word, follow these steps:
  1. If you want to use the results of an Access query or table as your data source in a Word mail merge, follow these steps:
    1. On the Tools menu, click Mail Merge.
    2. In the Mail Merge Helper, click Get Data, and then click Open Data Source.
    3. Proceed to step 3.
  2. If you want to insert the results of an Access query or table in a Word document, follow these steps:
    1. On the View menu, point to Toolbars, and then click Database.
    2. On the Database toolbar, click Insert Database.
    3. In the Database dialog box, click Get Data.
  3. In the Open Data Source dialog box, click MS Query.
  4. In the Choose Data Source dialog box on the Databases tab, click MS Access Database, and then click OK.

    NOTE: The Use the Query Wizard to create/edit queries check box is selected by default. This option uses the Query Wizard to step you through the process of building a simple query that returns data to Microsoft Excel or another parent program. This is the procedure described here. Clear the Use the Query Wizard to create/edit queries check box to use Microsoft Query without the Query Wizard.
  5. In the Select Database dialog box, click the Access database file that you want to use, and then click OK.

    NOTE: If you select the Read Only check box, you can read the file but cannot make changes to it. If you select the Exclusive check box, the database file is locked during the time that Word is using the Access database.
  6. In the Available tables and columns list in the Query Wizard - Choose Columns dialog box, make the selections that you want to use for your query, add them to the Columns in your query list, and then click Next.
  7. In the Query Wizard - Filter Data dialog box, filter the data to specify which rows to include in your query. If you do not want to filter the data, click Next.
  8. In the Query Wizard - Sort Order dialog box, specify how you want your data sorted. If you do not want to sort your data, click Next.
  9. In the Query Wizard - Finish dialog box, do one of the following:
    • Click Save Query to run the query, and then add this query to the list of available queries. Use this list when you choose a query to run from Excel or Microsoft Query or when you choose a data source. When you click Save Query, the query's design is saved as the following file type:

      *.dqy

      -or-
    • Click Return Data to Microsoft Word, and then click Finish to run the query and return the query results to Word.

      -or-
    • Click View data or edit query in Microsoft Query, and then click Finish to run the query and return the query results to Microsoft Query. You can view the data and make additional changes to your query in Microsoft Query before you return the data to Word.
NOTE: When you try to use Access as a data source in Microsoft Query, you may receive the following error message:
Word was unable to open the data source.
This behavior may occur when you use an Access query or table.

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

224056 WD2000: Error Message: Word Was Unable to Open the Data Source

back to the top

How to Export and Use Your Data from Access as a Word Data Source

To export and use your data from Access as a Word data source, follow these steps:
  1. In Access, open your database table or query.
  2. On the File menu, click Export.
  3. In the Export Table or Export Query dialog box, follow these steps:
    1. In the Save as type list, click Microsoft Word Merge.
    2. In the File name box, type a name for the exported file.
    3. In the Save in list, select the folder in which to save the file.
  4. Click Save All.

    Access now exports your table or query result as a tab-delimited text file.
  5. Close your database, and then quit Access.
In Word, use the exported tab-delimited text file to continue your Word mail merge or to insert the database file as usual.

back to the top

How to Copy, Paste, and Use Access Data as a Word Data Source

To copy, paste, and use Access data as a Word data source, follow these steps:
  1. Open your Access database table or query.
  2. On the Edit menu, click Select All Records.
  3. On the Edit menu, click Copy.
  4. Open a new, blank document in Microsoft Word.
  5. Use one of the following methods.
back to the top

Method 1: Save Data as a Table

  1. On the Edit menu, click Paste Special. In the Paste Special dialog box, click Formatted Text (RTF) under As.

    The information from your Access table or query is pasted into a Word table.
  2. Save this new file as a Word document.

    This new file is your new Word data source.
back to the top

Method 2: Save Data in Tab-Delimited Format

  1. On the Edit menu, click Paste Special.
  2. In the Paste Special dialog box, click Unformatted Text, and then click OK.

    The information from your Access table or query is pasted into your Word document as tab-delimited text.
  3. On the File menu, click Save As.
  4. In the Save As dialog box, click Text Only in the Save as type box.
  5. In the File name box, type a name for your exported file.
  6. In the Save in list, select the folder in which to save the file, and then click Save. Click Yes in response to the following message

    File name may contain features that are not compatible with Text Only format. Do you want to save the document in this format?

    To save, click Yes.
    To preserve formatting, click No. Then save a copy in the latest Word format.

    where file name is the name of your Word document that contains the text from Access.
  7. Close your Word data source document, and then continue your Word mail merge, or insert your database file as usual.
back to the top

REFERENCES

For additional information about Mail Merge, click the article numbers below to view the articles in the Microsoft Knowledge Base:

212329 WD2000: How to Start a Mail Merge

212322 HOW TO: Design and Set Up Mail Merge Data in Microsoft Word 2000

For more information about how to insert a database into your Word document, click Microsoft Word Help on the Help menu, type insert Access data into a Word document in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

back to the top

Modification Type:MajorLast Reviewed:11/22/2002
Keywords:kbhowto kbHOWTOmaster kbmerge KB211190