T
Todd Lemen
I am using Access 2k3 to automate letterwriting (statements and invoices).
I have a word document built as a mail merge base file. It's data source is
linked to a Jet/ODBC oject stored in a sprcified location. The data source
is an MS Access 2k3 .mdb file bearing only tables for mail merges. The main
Access application carries links to these tables. QueryDefs in the main
application execute to populate these tables.
When I open the Word document, it tells me it will pull data from the .odc
file, and executes the mail merge properly. No problem. When I execute the
same from the main Access application, I ge Run-time error 4605:"This method
or property is not available because the document is not a mail merge main
document." Well. Yes it is... It runs as expected in Word 2K3...
OK. So, here's the code used to drive the mail merge from Access:
Dim appWord as New Word.Application
Dim docLetters As Word.Document
Dim qd as QueryDef
...........................
Set qd = db.QueryDefs!AppendStatementsReport
qd.Execute
Set qd = Nothing
Set docLetters = appWord.Documents.Open("C:\VMed\Statement2.doc")
appWord.Visible = True
docLetters.MailMerge.Execute
docLetters.Close
Error 4605 occurs at "docLetters.MailMerge.Execute"
Suggestions?
Thanks,
TL
I have a word document built as a mail merge base file. It's data source is
linked to a Jet/ODBC oject stored in a sprcified location. The data source
is an MS Access 2k3 .mdb file bearing only tables for mail merges. The main
Access application carries links to these tables. QueryDefs in the main
application execute to populate these tables.
When I open the Word document, it tells me it will pull data from the .odc
file, and executes the mail merge properly. No problem. When I execute the
same from the main Access application, I ge Run-time error 4605:"This method
or property is not available because the document is not a mail merge main
document." Well. Yes it is... It runs as expected in Word 2K3...
OK. So, here's the code used to drive the mail merge from Access:
Dim appWord as New Word.Application
Dim docLetters As Word.Document
Dim qd as QueryDef
...........................
Set qd = db.QueryDefs!AppendStatementsReport
qd.Execute
Set qd = Nothing
Set docLetters = appWord.Documents.Open("C:\VMed\Statement2.doc")
appWord.Visible = True
docLetters.MailMerge.Execute
docLetters.Close
Error 4605 occurs at "docLetters.MailMerge.Execute"
Suggestions?
Thanks,
TL