mailmerge from access password trouble

G

Guest

I am using VBA to mailmerge from Access 2003. My code works fine until I
protect the database with a password. I have coded the password into the
script (for test purposes) but the merge fails to go through automatically.
The 'Data Link Properties' dialog box comes up in Word for manual completion.
The OpenDataSource PasswordDocument argument just doesn't seem to do
anything.

I have spent a long time on this so would be very grateful for any help. My
code is below. Thanks a lot. David.

Dim objWord As Word.Document
Set objWord = GetObject(C:\MyMerge.doc, "Word.Document")
objWord.Application.Visible = True

objWord.MailMerge.OpenDataSource _
Name:="C:\Database.mdb", _
Connection:="TABLE tblthankyous", _
SQLStatement:="SELECT * FROM [tblthankyous]", _
LinkToSource:=True, _
Revert:=True, _
Passworddocument:="dd123"

objWord.MailMerge.Execute
 
G

Guest

Cracked it!

The password used by PasswordDocument is the User logon password - NOT the
Database password. Confusing, huh!
 

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