KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q193716: WD97: How to Use Microsoft Access 97 Data in Word

Article: Q193716
Product(s): Word 97 for Windows
Version(s): WINDOWS:97
Operating System(s): 
Keyword(s): kbdta word97 kbmerge
Last Modified: 14-NOV-2000

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Word 97 for Windows 
-------------------------------------------------------------------------------


SUMMARY
=======

This article explains how to do the following:

- How to Use a Microsoft Access Query or Table as a Word Data Source.

- How to Use MS Query to Retrieve MS Access Data as a Data Source in Word.

- How to Export and Use Your Data From MS Access as a Word Data Source.

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

MORE INFORMATION
================

Use one of the following procedures appropriate for your situation:

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

To use a Microsoft Access query or table as a Word data source, follow these
steps:

1. If you want to use the results of a Microsoft Access query or table as your
  data source in a Word mail merge, in the Mail Merge Helper (on the Tools
  menu, click Mail Merge), click Get Data and then click Open Data Source.

  -or-

  If you want to insert the results of a Microsoft Access query or table in a
  Word document, in the Database dialog box (on the Database toolbar, click
  Insert Database), click Get Data.

  NOTE: To access the Database toolbar, on the View menu, point to Toolbars and
  then click Database.

2. In the Open Data Source dialog box, follow these steps:

  a. Change the Files of Type box to "MS Access Databases."

  b. Click to select your Microsoft Access database file.

  c. Click to select the Select Method check box.

  d. Click Open.

3. In the Confirm Data Source dialog box, select "MS Access Databases via DDE
  (*.mdb)," and then click OK.

  NOTE: If "MS Access Databases via DDE (*.mdb)" is not available, you will need
  to remove and then reinstall Microsoft Access 97 for Windows.

4. In the Microsoft Access dialog box, select the Queries tab or the Tables tab.

5. Select the query or table you want to use, and then click OK.

  NOTE: On the Queries tab, the Create Link check box is selected by default.
  This option creates a link to the Microsoft 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 queries check box.

6. Word will return the results of your Microsoft Access query or table to your
  Word document.

  If you are using mail merge, Word will prompt 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 and continue your mail merge as usual.

  -or-

  If you are inserting database information, in the Database dialog box, click
  Insert Data. In the Insert Data dialog box, select either All to insert all
  of the results of the Microsoft Access query into your Word document or
  select From and specify which records you want to insert into your Word
  document.

  NOTE: In the Insert Data dialog box, the "Insert data as field" 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.

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

To use Microsoft Query to retrieve Microsoft Access data as a data source in
Word, follow these steps:

1. If you want to use the results of a Microsoft Access query or table as your
  data source in a Word mail merge, in the Mail Merge Helper (on the Tools
  menu, click Mail Merge), click Get Data and then click Open Data Source.

  -or-

  If you want to insert the results of a Microsoft Access query or table in a
  Word document, in the Database dialog box (on the Database toolbar, click
  Insert Database), click Get Data.

  NOTE: To access the Database toolbar, on the View menu, point to Toolbars and
  then click Database.

2. In the Open Data Source dialog box, click MS Query.

3. In the Choose Data Source dialog box, on the Databases tab, select "MS Access
  97 Database" and then click OK.

  NOTE: The "Use the Query Wizard to create/edit queries" check box is selected
  by default. This option will use the Query Wizard to step you through
  building a simple query that returns data to Microsoft Excel or another
  parent program. Clear the "Use the Query Wizard to create/edit queries" check
  box to use Microsoft Query rather than the Query Wizard to build your query.

4. In the Select Database dialog box, select the Microsoft Access database file
  that you want to use and then click OK.

  NOTE: If you select the Read Only check box, you will be able to read the file
  but cannot make changes to it. If you select the Exclusive check box, the
  database file will be locked during the time Word is using the Microsoft
  Access database.

5. In the "Query Wizard - Choose Columns" dialog box, in the "Available tables
  and columns" list, make the selections you want to use for your query and add
  them to the "Columns in your query" list and then click Next.

6. 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.

7. In the "Query Wizard - Sort Order" dialog box, specify how you want your data
  sorted. If you do not want to sort the data, click Next.

8. In the "Query Wizard - Finish" dialog box, select what you would like to do.

  Click Save Query to run the query and add this query to the list of available
  queries. Use this list when you choose a query to run from Microsoft Excel or
  Microsoft Query or when you choose a data source. Saves the query's design as
  the file type *.dqy.

  -or-

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

  -or-

  Click "View data or edit query in Microsoft Query," and then click Finish to
  run the query return the query results to Microsoft Query. You can view the
  data and make additional changes to your query in Microsoft Query before
  returning the data to Microsoft Word.


How to Export and Use Your Data From MS Access as a Word Data Source
--------------------------------------------------------------------

To export and use your data from Microsoft Access as a Word data source, follow
these steps:

1. Open your Microsoft Access database table or query.

2. On the File menu, click Save As/Export.

3. In the Save As dialog box, select "To an External File or Database" and then
  click OK.

4. In the "Save Query '<Queryname>' In" dialog box, follow these steps:

  a. Change the Save as type box to "Microsoft Word Merge (*.txt)".

  b. In the File name box, type a name for your exported file.

  c. In the Save in box, change to the folder that you want to save the file.

5. Click Export. Microsoft Access will now export your table or query result as
  a tab-delimited text file.

6. Close your database and quit Microsoft Access.

In Microsoft Word 97, continue your Word mail merge, or insert your database file
as usual.

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

To copy, paste, and use Microsoft Access data as a Word data source, following
these steps:

1. Open your Microsoft Access database table or query.

2. On the Edit menu, click Select All Records.

3. On the Edit menu, click Copy.

In Microsoft Word 97, follow these steps:

1. On the File menu, click New.

2. On the General tab, select the Blank Document icon and then click OK.

3. In your document use one of the following methods:

Method 1: Save Data in Table Format
-----------------------------------

  a. On the Edit menu, click Paste Cells. The information from your Microsoft
     Access table or query will be pasted into a Word table.

  b. Save (on the File menu, click Save As) this new file as (Save as type)
     "Word document (*.doc)". This new file will be your new Word data source.

Method 2: Save Data in Tab-delimited Format
-------------------------------------------

  a. On the Edit menu, click Paste Special.

  b. In the Paste Special dialog box, select Unformatted Text and then click
     OK. The information from your Microsoft Access table or query will be
     pasted into your Word document as tab-delimited text.

  c. On the File menu, click Save As.

  d. In the Save As dialog box, change the Save as type box to "Text Only
     (*.txt)".

  e. In the File name box, type a name for your exported file.

  f. In the Save in box, change to the folder that you want to save the file
     and then click Save.

4. Close your Word data source document and continue your Word mail merge, or
  insert your database file as usual.

REFERENCES
==========

For additional information, please see the following articles in the Microsoft
Knowledge Base:

  Q141922 WD97: How to Start a Mail Merge

  Q142756 WD97: How to Design and Set Up Mail Merge Data Sources

For more information about inserting a database into your Word document, click
Contents And Index on the Help menu, click the Index tab in Microsoft Word Help,
type the following text

  databases, inserting

and then double-click the selected text to go to the "<exact topic text>"
topic. If you are unable to find the information you need, ask the Office
Assistant.

Additional query words: datasource msaccess

======================================================================
Keywords          : kbdta word97 kbmerge 
Technology        : kbWordSearch kbWord97 kbWord97Search kbZNotKeyword2
Version           : WINDOWS:97
Issue type        : kbinfo

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.