ACC2000: How to Use a Secured Database in Word Mail Merge

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).

SUMMARY
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.
MORE INFORMATION
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

  1. Start Word, create a new document, and then save the document as TestMerge.doc.
  2. On the Tools menu, click Mail Merge.
  3. Click Create, click Form Letters, and then click Active Window.
  4. 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).
  5. Locate and select the secured database you created. Click to select the Select Method check box, and then click Open.
  6. Click MS Access Databases Via DDE, and then click OK.
  7. 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.
  8. 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.
  9. On the Mail Merge toolbar, click Insert Merge Field. Add several fields to the document.
  10. On the Mail Merge toolbar, click Merge To New Document, and then verify that the merge is successful.
  11. 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

  1. Follow steps 1 through 5 in method 1.
  2. Click MS Access Databases via ODBC, and then click OK.
  3. 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.
  4. From the list of tables in the secure database, click any table that holds some data, click OK, and then click Edit Main Document.
  5. On the Mail Merge toolbar, click Insert Merge Field, and then add several fields to the document.
  6. 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.
REFERENCES
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.
Properties

Article ID: 208933 - Last Review: 02/23/2014 01:13:23 - Revision: 2.1

  • Microsoft Access 2000 Standard Edition
  • Microsoft Word 2000 Standard Edition
  • kbnosurvey kbarchive kbhowto kbinterop KB208933
Feedback