Access VBA mailmerge to Word broken in upgrade from '97 to 2003

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,
 
D

David Lloyd

Steve:

I do not know whether the following KB article is one that you have already
found, however, it deals with the error message you are receiving, so I
thought I would pass it along.

http://support.microsoft.com/default.aspx?scid=kb;en-us;224056

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


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,
 
S

Steve Commisso

Yeah, I've tried that one... the other was the KB article that has you change
the following registry key:

[HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Word\Options]
"SQLSecurityCheck"=dword:00000000

Thanks for trying, though.

One thing I noticed is that when I try and manually do the mail merge from
Word is that the query I want to get the data from doesn't show up in the
list of tables/queries in my datasource. Only queries with no parameters
show up in the list, any the query I want pulls a form value from Access.
I'm not sure if this has anything to do with my problem, though.
 
D

David Lloyd

Steve:

Here are a couple more KB articles related to this error, again, if you have
not seen these already.

http://support.microsoft.com/default.aspx?scid=kb;en-us;888697
http://support.microsoft.com/default.aspx?scid=kb;en-us;833736


--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Yeah, I've tried that one... the other was the KB article that has you
change
the following registry key:

[HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Word\Options]
"SQLSecurityCheck"=dword:00000000

Thanks for trying, though.

One thing I noticed is that when I try and manually do the mail merge from
Word is that the query I want to get the data from doesn't show up in the
list of tables/queries in my datasource. Only queries with no parameters
show up in the list, any the query I want pulls a form value from Access.
I'm not sure if this has anything to do with my problem, though.
--
Steve Commisso
Consultant
Software Architects, Inc.


David Lloyd said:
Steve:

I do not know whether the following KB article is one that you have
already
found, however, it deals with the error message you are receiving, so I
thought I would pass it along.

http://support.microsoft.com/default.aspx?scid=kb;en-us;224056

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or
warranties.


message
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,
 
D

david epsom dot com dot au

Here is another thing to check:

Create a shortcut to the query by dragging the query from the database to
the desktop.

With the application still open, Double Click on the shortcut to test the
query.

I think those query shortcuts use DDE to automate MSAccess if the
application is open

(david)

BTW, the query short cut is a text file with extension ".maq"
Why doesn't the extension show in Windows Explorer?
 
S

Steve Commisso

Hmm, I'm getting an "ODBC call failed" when I run the query shortcut. Is
there a way to specify using DDE?
--
Steve Commisso
Consultant
Software Architects, Inc.


david epsom dot com dot au said:
Here is another thing to check:

Create a shortcut to the query by dragging the query from the database to
the desktop.

With the application still open, Double Click on the shortcut to test the
query.

I think those query shortcuts use DDE to automate MSAccess if the
application is open

(david)

BTW, the query short cut is a text file with extension ".maq"
Why doesn't the extension show in Windows Explorer?


Steve Commisso said:
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,
 
S

Steve Commisso

One of the subqueries is calling a linked table, that's part of what the
problem is. Thanks.
--
Steve Commisso
Consultant
Software Architects, Inc.


Steve Commisso said:
Hmm, I'm getting an "ODBC call failed" when I run the query shortcut. Is
there a way to specify using DDE?
--
Steve Commisso
Consultant
Software Architects, Inc.


david epsom dot com dot au said:
Here is another thing to check:

Create a shortcut to the query by dragging the query from the database to
the desktop.

With the application still open, Double Click on the shortcut to test the
query.

I think those query shortcuts use DDE to automate MSAccess if the
application is open

(david)

BTW, the query short cut is a text file with extension ".maq"
Why doesn't the extension show in Windows Explorer?


Steve Commisso said:
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,
 
S

Steve Commisso

Thanks! It's all set. I really appreciate the help.
--
Steve Commisso
Consultant
Software Architects, Inc.


David Lloyd said:
Steve:

Here are a couple more KB articles related to this error, again, if you have
not seen these already.

http://support.microsoft.com/default.aspx?scid=kb;en-us;888697
http://support.microsoft.com/default.aspx?scid=kb;en-us;833736


--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Yeah, I've tried that one... the other was the KB article that has you
change
the following registry key:

[HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Word\Options]
"SQLSecurityCheck"=dword:00000000

Thanks for trying, though.

One thing I noticed is that when I try and manually do the mail merge from
Word is that the query I want to get the data from doesn't show up in the
list of tables/queries in my datasource. Only queries with no parameters
show up in the list, any the query I want pulls a form value from Access.
I'm not sure if this has anything to do with my problem, though.
--
Steve Commisso
Consultant
Software Architects, Inc.


David Lloyd said:
Steve:

I do not know whether the following KB article is one that you have
already
found, however, it deals with the error message you are receiving, so I
thought I would pass it along.

http://support.microsoft.com/default.aspx?scid=kb;en-us;224056

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or
warranties.


message
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,
 

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