This article was previously published under Q208933
This article has been archived. It is offered "as is" and will no longer be updated.
Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies only to a Microsoft Access database (.mdb).
This article describes how to use a secured Microsoft Access database in aMicrosoft 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 mustlog on using a valid Microsoft Access account. Microsoft Word for Windowsdoes not open a merge document if you do not have "Read Data" permission onthe 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 TestMerge.doc.
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 ControlPanel. Creating a new ODBC data source with the 32-bit Microsoft Accessdriver lets you specify the default database, user name, and workgroup file(System.mdw).
To avoid being prompted for a user name and password each time you openthe 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.