Microsoft KB Archive/830870

= Error message when you try to insert a selection of database records into a Word document: &quot;Word was not able to open the data source&quot; =

Article ID: 830870

Article Last Modified on 12/19/2006

-

APPLIES TO


 * Microsoft Office Word 2007
 * Microsoft Office Word 2003

-



SYMPTOMS
When you insert a database into a Microsoft Word document by using a query, and when you choose to insert the database records as a field, you may receive the following error message:

Word was not able to open the data source.

After you click OK, you receive the following error message:

Word could not replace the selection with the specified database.

In the Word document where you wanted to insert the database records as a field, Word inserts the following text instead:

Error! Cannot open data source.



CAUSE
This problem may occur if you choose to insert the database records as a field, instead of as a table. The field code that is generated has an error in the syntax of the WHERE statement.



WORKAROUND
To work around this problem, use one of the following methods.

Modify the field code syntax
To modify the field code, follow these steps.

Note These steps assume that you are using an existing field code entry in your document.
 * 1) Right-click the field code, and then click Toggle Field Codes.
 * 2) Locate the WHERE statement.

Typically, the WHERE statement of the field code is at the end of the field code text.
 * 1) Put the insertion point before the word WHERE.
 * 2) Insert a blank space before the word WHERE.
 * 3) Right-click the field code, and then click Update Field.

The field code will be updated correctly.

Insert database records as a table
You can insert records that are returned from a query as a table and not as a field. To do this, follow these steps:
 * 1) In Microsoft Office Word 2003, click Insert Database on the Database toolbar.

In Microsoft Office Word 2007, click Insert Database on the Quick Access Toolbar if you have added this button to the Quick Access Toolbar.
 * 1) Click Get Data.
 * 2) Click Browse, and then locate your data source.

Click Open.
 * 1) Click Query Options, and then create your query.

Click OK.
 * 1) Click Insert Data.
 * 2) If the Insert data as field check box is selected, click to clear the Insert data as field check box.
 * 3) Select the range of records, or click All, and then click OK.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.

Additional query words: WD2k3 WD2003 WD2007

Keywords: kberrmsg kbdatabase kbquery kbprb KB830870

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.