This article describes how to use a secured Microsoft Access database in a
Microsoft Word for Windows mail merge. This article assumes you have already created or have access to a secured Access database.
To access a secured Microsoft Access database using Open Database Connectivity (ODBC) or Dynamic Data Exchange (DDE), you must
log on using a valid Microsoft Access account. Microsoft Word for Windows
does not open a merge document if you do not have "Read Data" permission on
the table or query that is specified as the data source.
You can create a merge document in Microsoft Word using either DDE or ODBC to access a secured database. Choose either of the following methods.
Method 1: Create a Merge Document in Word, Using DDE to Access the Secured Database
Start Word, create a new document, and then save the document as
On the Tools menu, click Mail Merge.
Click Create, click Form Letters, and then click Active Window.
In the Mail Merge Helper, click Get Data, click Open Data Source, and then in the Files of type box, click MS Access Databases (*.mdb).
Locate and select the secured database you created. Click to select the Select Method check box, and then click Open.
Click MS Access Databases Via DDE, and then click OK.
When prompted, type the user name and password for an account that has permissions, and then click OK.
NOTE: If you have set a database password for the database that you are trying to open, you are also prompted to enter that password.
From the list of tables in the secure database, select the any table that holds some data, click OK, and then click Edit Main Document.
On the Mail Merge toolbar, click Insert Merge Field. Add several fields to the document.
On the Mail Merge toolbar, click Merge To New Document, and then verify that the merge is successful.
Save and close TestMerge.doc, and then try to reopen the document. When prompted, type the user information for an account that should not have permissions. Verify that the document fails to open.
Create a Merge Document in Word, Using ODBC to Access the Secured Database
Follow steps 1 through 5 in method 1.
Click MS Access Databases via ODBC, and then click OK.
If you receive a message stating that the default login is invalid, click OK, type the user name and password for the account that has permissions, and then click OK.
From the list of tables in the secure database, click any table that holds some data, click OK, and then click Edit Main Document.
On the Mail Merge toolbar, click Insert Merge Field, and then add several fields to the document.
Click the Merge To New Document button on the Mail Merge toolbar, and then verify that the merge is successful.
You can create new ODBC data sources using the ODBC icon in Control
Panel. Creating a new ODBC data source with the 32-bit Microsoft Access
driver lets you specify the default database, user name, and workgroup file
To avoid being prompted for a user name and password each time you open
the document, add this information to the connect string programmatically.
For more information about creating a secured database, click Microsoft Access Help on the Help menu, type security in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
For more information about passing the user name and password in a connection string, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type odbcconnectstr property in the Office Assistant or the Answer Wizard, and then click Search to view the topic.