WordBasic Examples Using ODBC: MailMergeOpenDataSource |
Q110334
This article contains an example that demonstrates the use of the following WordBasic statement or function:
MailMergeOpenDataSourceThis article supplements the information in online Help. To open this Help topic, choose Contents from the Help menu and then choose Programming with Microsoft Word.
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]
This macro connects to the Microsoft Access NWIND.MDB database, using the
records in the Customers table as the data source for a Word 6.0 for
Windows Mail Merge:
Sub MAIN
Q$ = Chr$(34)
connect$ = "DSN=MS Access Databases;"
connect$ = connect$ + "DBQ=c:\access\nwind.mdb;"
connect$ = connect$ + "FIL=RedISAM;"
MailMergeOpenDataSource .Name = "c:\access\nwind.mdb", .Connection = \
connect$, .SQLStatement = "SELECT * FROM Customers"
End Sub
Note: To determine the connection and query strings for
MailMergeOpenDataSource, set query options manually, and then use
MailMergeDataSource$() to return the strings.
DSN=MS Access Databases;DBQ=c:\access\nwind.mdb;FIL=RedISAM
Keyword Description
------- -----------
DSN Name of the Microsoft Access data source
UID The user login ID
PWD The user-specified password
DBQ The Microsoft Access database
FIL File type (RedISAM)
To use a database that requires both a user login ID and a user-specified
password, add the above keywords to the connection string. For example:
DSN=MS Access Databases;UID=Smith;PWD=Sesame;DBQ=C:\ACCESS\NWIND.MDB;
FIL=RedISAM
Word Developer's Kit, p. 579.
The Microsoft Access ODBC Help file, DRVACCSS.HLP, located in the Windows
SYSTEM subdirectory.
Additional query words: 6.0 ODBC access winword word6
Keywords : kbmacroexample kbofficeprog
Issue type :
Technology :
|
Last Reviewed: March 28, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |