Microsoft KB Archive/111278

From BetaArchive Wiki

Overview: How to Use ODBC with Word 6.0 for Windows

Q111278

6.00 6.00a WINDOWS



The information in this article applies to:


  • Microsoft Word for Windows, versions 6.0, 6.0a





SUMMARY

This article discusses ways you can use Open Database Connectivity (ODBC) in Word for Windows.

Word uses ODBC to retrieve information from single-tier, file-based, relational and nonrelational databases for mail merge and database operations. ODBC frees Word from having to convert, insert, or link a database in a Word document. With ODBC, Word can open and retrieve requested database data from a database file for use in a mail merge operation while maintaining the database file's original file format and structure.

Word includes ODBC drivers that can read Microsoft Access 1.0 and 1.1 for Windows; dBASE III, III+, and IV; and Paradox 3.5 for MS-DOS database files. Word can also read files saved from Microsoft FoxPro 2.0, 2.5, and 2.5a for MS-DOS and Microsoft FoxPro 2.5 and 2.5a for Windows, as these versions of FoxPro save in supported dBASE formats.

Note: You cannot use ODBC to open files via File Open or save files via File Save or File Save As.



MORE INFORMATION

Word uses ODBC in the following ways:


Tools Mail Merge, Get Data

To mail merge a relational database with a Word form letter, envelope, catalog, or mailing label:




  1. Choose Mail Merge from the Tools menu.
  2. Choose the Get Data button.
  3. Select the Confirm Conversions box.
  4. Select or provide Word with the correct drive, directory, and filename of your database file. Choose the OK button.
  5. Choose the ODBC option in the Confirm Data Source box (you should see a DDE and ODBC option), and choose the OK button twice.

Insert Database

When you choose Database from the Insert menu, Word will insert a database directly into a Word document in table format. The Insert Database feature provides query options for database record filtering, record sorting, and field selection as well as table formatting options.




DATABASE Field

When you access a database file with the DATABASE field, you can insert requested records into a Word document in table format:


  1. From the Insert menu, choose Field.
  2. In the Categories box, select the Mail Merge.
  3. In the Field Names box, select Database.
  4. Choose the Options button to insert any DATABASE field options.

The following DATABASE field will insert all of the records from the EMPLOYEES table in the Microsoft Access database NWIND.MDB into a Word document in table format:




{DATABASE \d "C:\\ACCESS\\NWIND.MDB" \c "DSN=MS Access Databases; DBQ=C:\\ACCESS\\NWIND.MDB;FIL=RedISAM" \s "SELECT * from EMPLOYEES" \* MERGEFORMAT}

Microsoft Query

"Microsoft Query" provides access to relational and two-tier databases. It allows you to view, edit, and organize database data and insert it into a Windows-based application. While Microsoft Query does not ship with Microsoft Word, Word will support Microsoft Query's use and be aware of its presence. If Microsoft Query has been installed, Word will ask if you would prefer to use Microsoft Query to access your database when choosing the Get Data button in a mail merge main document. Microsoft Query ships with Microsoft Excel version 5.0 for Windows.




For additional information about ODBC drivers, please see the following article in the Microsoft Knowledge Base:

Q132131 INF: ODBC Database Drivers 2.0 Supported Platforms



REFERENCES

"Microsoft Word User's Guide," version 6.0, pages 624-632, 677

"Microsoft Word Developer's Kit," 1994, Microsoft Press, pages 901-927

Additional query words: conv wm_query access word6 winword

Keywords : kbprint kbmerge
Issue type : kbhowto
Technology :


Last Reviewed: November 4, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.