The following is a description of an additional function available in the 
ODBC extensions for Microsoft Word. This description can be used in 
combination with the reference entries in Appendix B, "ODBC Extensions 
for Microsoft Word," for full documentation of the functions provided in 
WBODBC.WLL.

---------------------
SQLRetrieveToDocument
---------------------

Description	Retrieves the results of a query and places the entire 
		contents into a table in the active document.

Syntax		Declare Function SQLRetrieveToDocument Lib "WBODBC.WLL"(
			connect_num As Integer)  As Integer

Remarks		To use SQLRetrieveToDocument, a macro must have already
		established a connection using SQLOpen. Also, a query must
		already have been executed using SQLExecQuery, and results
		must be pending.

Parameters	connect_num    The unique connection ID of the data source 
			you want to query returned by a previously executed
			SQLOpen function. If connect_num is not valid, 
			SQLRetrieveToDocument returns 0 (zero).

Return Values	If the pending query result cannot be returned successfully,
		SQLRetrieveToDocument returns a negative error value. 

Example		The following example establishes a connection to a data
		source, queries the data source to select every record, 
		and then uses SQLRetrieveToDocument to insert the entire
		data source in a table in a new Word document.

		connect_num = SQLOpen("DSN=test.mdb", output_ref$, 0)
		ret = SQLExecQuery(connect_num, "Select * from table4 " + \
			Quote2$("name"))
		FileNew
		ret = SQLRetrieveToDocument(connect_num)
		ret = SQLClose(connect_num)


---------------
DOCUMENT ERRATA
---------------

Please note the following error in Appendix B, "ODBC Extensions for
Microsoft Word":

-- Page 905 --
The appendix incorrectly states that Microsoft SQL Server is one of the 
ODBC drivers shipped with Microsoft Word 6.0. The only ODBC drivers shipped
with Word are Microsoft Access, Microsoft FoxPro, Paradox, and dBASE, as
listed on page 905.

A Microsoft SQL Server ODBC driver currently ships with Microsoft Access
version 1.1 and Visual Basic version 3.0. If you own either of these
products, you can create SQL Server data sources.

If you are a Microsoft SQL Server for Windows NT customer, you will find a
Microsoft SQL Server ODBC driver included in the SQL Server for Windows NT 
product.

