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

ID: Q120810


The information in this article applies to:


SUMMARY

Advanced: Requires expert coding, interoperability, and multiuser skills.

To access a secured Microsoft Access database using ODBC or DDE, you must log on using a valid Microsoft Access account. Microsoft Word for Windows will 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.

This article describes how to use a secured Microsoft Access database in a Microsoft Word for Windows mail merge.


MORE INFORMATION

This article describes how to complete the following tasks to set up an example of using a secured Microsoft Access database in a Word mail merge:

Detailed instructions for these tasks are listed below.

Create a Merge Document in Word, Using DDE to Access the Secured Database


  1. Start Word and create a new document. Save the document as TESTMRG.DOC.


  2. On the Tools menu, click Mail Merge. Click the Create button, select Form Letters, and then click the Active Window button.


  3. Click the Get Data button, select Open Data Source, and then in the Files Of Type box, select MS Access Databases (*.mdb).


  4. Locate and select the secured database you created. In Word version 6.0, select the Confirm Conversions check box, and then click OK. In Word 7.0 and 97, select the Select Method check box, and then click Open.


  5. Select MS Access Databases Via DDE, and then click OK.


  6. When you are prompted, enter the user name and password for the account that has permissions, and then click OK.

    NOTE: If you are using Microsoft Access 97 and have set a Database password for the database you are trying to open, you will have to enter that password when prompted.


  7. Select the Mailing List table, click OK, and then click the Edit Main Document button.


  8. Click the Insert Merge Field button on the Mail Merge toolbar. Add several fields to the document.


  9. Click the Merge To New Document button on the Mail Merge toolbar and verify that the merge is successful.


  10. After saving, try to reopen the document. When you are prompted, enter 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-4 in section 2 above.


  2. Select "MS Access <x.x> Databases via ODBC," and then click OK.


  3. When you receive a message stating that the default login is invalid, click OK, and then enter the user name and password for the account that has permissions. Click OK.


  4. Select the Mailing List table, click OK, and then click the Edit Main Document button.


  5. Click the Insert Merge Field button on the Mail Merge toolbar. Add several fields to the document.


  6. Click the Merge To New Document button on the Mail Merge toolbar and 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 (SYSTEM.MDW).

NOTE: If you are using a version of Microsoft Access earlier than 7.0, you will only be allowed to specify the default database and user name.

To avoid being prompted for a user name and password each time you open the document, add this information to the connect string programmatically.


REFERENCES

For information about creating a WordBasic macro to set the connect string, please see the following article in the Microsoft Knowledge Base:

Q110334 WordBasic Examples Using ODBC: MailMergeOpenDataSource



For information about securing a database in Microsoft Access version 2.0, please see the following article in the Microsoft Knowledge Base:

Q132143 ACC2: Overview of How to Secure a Microsoft Access Database

For information about securing a database in Microsoft Access 97, search the Help Index for "How do I secure a database."


Keywords          : kbinterop 
Version           : 2.0 7.0 97
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: April 6, 1999