DATABASE [switches ]

Inserts the results of a database query in a Microsoft Word table.


switches 
\b "Sum"Specifies which attributes of the format set by the \l switch to apply to the table
If the \l switch is blank, the \b switch value must be 16 (AutoFit)
Include the sum of any combination of the following values to specify the value for the switch:
0 = No formatting
1 = Borders
2 = Shading
4 = Font
8 = Colour
16 = AutoFit
32 = Heading Rows
64 = Last Row
128 = First Column
256 = Last Column
\c "connectinfo"Specifies a connection to the data
For example, a query to a range of cells in Microsoft Excel might contain the connection instructions \c "DSN=MS Access Databases; DBQ=C:\\Data\\Sales93.mdb; FIL=RedISAM;".
\d "location"The path and file name of the database
Used for all database queries except a query to an SQL database table using ODBC
Use double backslashes in the path - for example, "C:\\Data\\Sales94.mdb".
\f "startnumber"Specifies the record number of the first data record to insert - for example, \f "2445".
\hInserts field names from the database as column headings in the resulting table.
\l "format#"Applies a format from the Table AutoFormat dialog box (Table menu) to the result of the database query
The number Format# is determined by the table format you select in the dialog box
If this switch is used and the \b switch doesn't specify the table attributes, Word inserts an unformatted table.
\oInserts data at the beginning of a merge
\s "sql"SQL instructions
You must insert a backslash (\) before each quotation mark in the instructions
For example, instructions for a Microsoft Access database might be as follows: select * from \s \Customer List\"".
\t "endnumberSpecifies the record number of the last data record to insert - for example: \t "2486".

REMARKS
* This field can be inserted using the Insert Database button on the Database toolbar.
* If the number of columns is 62 or greater, the DATABASE field inserts the results of a query in columns separated by tabs. The DATABASE field contains all the information needed to connect to a database and perform a Structured Query Language (SQL) query. You update the field to query the database again.
* For the Microsoft documentation refer to support.microsoft.com

Examples

The following field results from a query to a Microsoft Access database through ODBC using the Database command:
{ DATABASE \d "C:\\Data\\Sales93.mdb" \c "DSN=MS Access Database; DBQ=C:\\Data\\Sales93.mdb; FIL=RedISAM" \s "select * from [Customer List] " \f "2445" \t "2486" \l "2" }

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top