S
Steve Commisso
I have an Access 97 database that executes a Mail Merge to a Word document.
This all worked fine on NT machines with Office '97 installed. However, we
are in the middle of upgrading our workstations to XP machines with Office
2003 installed. The mail merge no longer works. I've looked around on the web
and through some knowledge base articles and could not find a fix that worked.
Basically, when the Mail Merge code excecutes, Word opens and I'm presented
with a 'Confirm Data Source' dialog. I choose 'MS Access Databases via DDE'
because I wish to connect to a Query. After this, Visual Basic pops a dialog
with the following message:
"Run-time error '5922': Word was unable to open the data source."
Any ideas on what could be causing this? My source code is below.
Source Code:
Dim objWord As Word.Document
Set objWord = GetObject("<pathtomailmergetemplate>", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source
objWord.MailMerge.OpenDataSource _
Name:="<pathtomdbfile>", _
LinkToSource:=True, _
Connection:="QUERY <queryName>", _
SQLStatement:="Select * from [<queryName>]"
' Execute the mail merge.
objWord.MailMerge.Execute
Thanks,
This all worked fine on NT machines with Office '97 installed. However, we
are in the middle of upgrading our workstations to XP machines with Office
2003 installed. The mail merge no longer works. I've looked around on the web
and through some knowledge base articles and could not find a fix that worked.
Basically, when the Mail Merge code excecutes, Word opens and I'm presented
with a 'Confirm Data Source' dialog. I choose 'MS Access Databases via DDE'
because I wish to connect to a Query. After this, Visual Basic pops a dialog
with the following message:
"Run-time error '5922': Word was unable to open the data source."
Any ideas on what could be causing this? My source code is below.
Source Code:
Dim objWord As Word.Document
Set objWord = GetObject("<pathtomailmergetemplate>", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source
objWord.MailMerge.OpenDataSource _
Name:="<pathtomdbfile>", _
LinkToSource:=True, _
Connection:="QUERY <queryName>", _
SQLStatement:="Select * from [<queryName>]"
' Execute the mail merge.
objWord.MailMerge.Execute
Thanks,