mailmerge from access password trouble

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Cracked it!

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