MailMergeOpenDataSource

Syntax

MailMergeOpenDataSource .Name = text [, .ConfirmConversions = number] [, .ReadOnly = number] [, .LinkToSource = number] [, .AddToMru = number] [, .PasswordDoc = text] [, .PasswordDot = text] [, .Revert = number] [, .WritePasswordDoc = text] [, .WritePasswordDot = text] [, .Connection = text] [, .SQLStatement = text] [, .SQLStatement1 = text]

Remarks

Attaches the specified data source to the active document, which becomes a main document if it is not one already.

Argument

Explanation

.Name

The name of the data source. In Windows, you can specify a Microsoft Query (.QRY) file instead of a specifying a data source, a connection string, and a query string.

.LinkToSource

If 1, the query specified by .Connection and .SQLStatement is performed each time the main document is opened.


Argument

Explanation

.Connection

Specifies a range within which to perform the query specified by .SQLStatement. How you specify the range depends on how data is retrieved. For example:

u When retrieving data through ODBC (Windows only), you specify a connection string.

u When retrieving data from Microsoft Excel using dynamic data exchange (DDE), you specify a named range.

u When retrieving data from Microsoft Access (Windows only), you specify the word "Table" or "Query" followed by the name of a table or query.

.SQLStatement

Defines query options for retrieving data.

.SQLStatement1

If the query string is longer than 255 characters, .SQLStatement specifies the first portion of the string and .SQLStatement1 specifies the second portion.


Note

To determine the connection and query strings, set query options manually, and then use MailMergeDataSource$() to return the strings.

For descriptions of other arguments, see FileOpen.

See Also

FileOpen, MailMergeCreateDataSource, MailMergeEditDataSource, MailMergeOpenHeaderSource