Microsoft KB Archive/193716

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

Article ID: 193716

Article Last Modified on 1/23/2007

-

APPLIES TO


 * Microsoft Word 97 Standard Edition

-



This article was previously published under Q193716





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:

 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. In the Open Data Source dialog box, follow these steps:  Change the Files of Type box to "MS Access Databases." Click to select your Microsoft Access database file. Click to select the Select Method check box. Click Open.</li></ol> </li> 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.</li> In the Microsoft Access dialog box, select the Queries tab or the Tables tab.</li> 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.</li> 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.</li></ol>

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:

<ol> 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.</li> In the Open Data Source dialog box, click MS Query.</li> 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.</li> 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.</li> 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.</li> 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.</li> 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.</li> 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.</li></ol>

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:

<ol> Open your Microsoft Access database table or query.</li> On the File menu, click Save As/Export.</li> In the Save As dialog box, select "To an External File or Database" and then click OK.</li> In the "Save Query '<Queryname>' In" dialog box, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>Change the Save as type box to "Microsoft Word Merge (*.txt)".</li> <li>In the File name box, type a name for your exported file.</li> <li>In the Save in box, change to the folder that you want to save the file.</li></ol> </li> <li>Click Export. Microsoft Access will now export your table or query result as a tab-delimited text file.</li> <li>Close your database and quit Microsoft Access.</li></ol>

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:

<ol> <li>On the File menu, click New.</li> <li>On the General tab, select the Blank Document icon and then click OK.</li> <li> In your document use one of the following methods:

Method 1: Save Data in Table Format
<ol style="list-style-type: lower-alpha;"> <li>On the Edit menu, click Paste Cells. The information from your Microsoft Access table or query will be pasted into a Word table.</li> <li>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.</li></ol>

Method 2: Save Data in Tab-delimited Format
<ol style="list-style-type: lower-alpha;"> <li>On the Edit menu, click Paste Special.</li> <li>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.</li> <li>On the File menu, click Save As.</li> <li>In the Save As dialog box, change the Save as type box to "Text Only (*.txt)".</li> <li>In the File name box, type a name for your exported file.</li> <li>In the Save in box, change to the folder that you want to save the file and then click Save.</li></ol> </li> <li>Close your Word data source document and continue your Word mail merge, or insert your database file as usual.</li></ol>

<div class="references_section">