Mail merge datasource

  • Thread starter Günter Brandstätter
  • Start date
G

Günter Brandstätter

Hi all,
I have a mailmerge document, which opens a password-protected Access
database. How can I "automate" the password, so that I don't need to type it
every time?
I tried the code
objDoc.MailMerge.OpenDataSource Name:="Name of Database", ReadOnly:=True,
LinkToSource:=True, Revert:=False, Connection:="QUERY not yet printed",
AddToRecentFiles:=False, PasswordDocument:="Password",
PasswordTemplate:="Password"
but it does not work.

Any answer appreciated
Günter
 
G

Günter Brandstätter

Hi Cindy,

1. I use Word and Access 2000.
2. this is simple password protection.

I hope you can help
thanks for your answer
Günter
 
C

Cindy M -WordMVP-

Hi Günter,
1. I use Word and Access 2000.
2. this is simple password protection.
OK. You can't do this with the default DDE connection
method on which the code in your original message is based.
ODBC, it appears, can handle it. Here's some sample code I
recorded in Word 2000; pay special attention to the PWD and
UID parts of Connection argument.

ActiveDocument.MailMerge.OpenDataSource Name:= _
"H:\PATH\SAMPLES\Northwind.mdb",
ConfirmConversions:= _
False, ReadOnly:=False, LinkToSource:=True,
AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="",
WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False,
Format:=wdOpenFormatAuto, _
Connection:= _
"DSN=MS Access
Database;DBQ=H:\Apps_E\O_2003\OFFICE11\SAMPLES\Northwind.md
b;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;PWD=test;UID=admin;
" _
, SQLStatement:="SELECT * FROM `Customers`",
SQLStatement1:=""

In order to record this on your own machine, activate the
"Select method" checkbox in the Open Datasource dialog box.
Note that if you've not used the full security the UID
(user identifier) for Access is always "admin".

Note: In your code snippet you tried putting the password
in the various password arguments of the OpenDatasource
method. These are for *WORD* files and have nothing to do
with the datasource.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
G

Günter Brandstätter

Hi Cindy,

this helped me to clarify a bit. I also tried to edit the Connect-string,
but had no idea how to do it. Your solution helped me a lot.

Thanks again
Günter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top