View Single Post
  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default access query mailmerge - no data

You'll probably have to open the data source using VBA. How to do that
depends on your code, but if you are automating Word to open the document,
at some point you may have something like:

Set objWord = CreateObject("Word.Document")
Set objDoc = objWord.Open "the document pathname"

in which case you can put

objDoc.MailMerge.OpenDataSource _
Name:="the pathname of the access .mdb", _
Connection:="", _
SQLStatement:="SELECT * FROM [the name of the table/query]"

You will probably need something in the Connection parameter as well, but
try that first.

You can also put an AutoOpen macro in the Word document that does something
similar.

Peter Jamieson
Peter Jamieson

"Melissa" wrote in message
...
Thanks Peter. I was getting that message, and adding SQLSecurityCheck to
the
registry got rid of it. However, I'm still having the same problem. The
query is pulling 12 records and opening word, but still no data, and the
mailmerge toolbar is greyed out. Any more ideas?

Thanks

Melissa

"Peter Jamieson" wrote:

I have a form built to run a query then merge
with word.


In this case, what code does the form use to start Word and open the
document?

With recent updates to Word 2000, you will probably need to read and
apply

"Opening This Will Run the Following SQL Command" Message When You Open a
Word Document"

at

http://support.microsoft.com?kbid=825765

even though the article's name does not obviously describe your problem.


Peter Jamieson

"Melissa" wrote in message
...
hello,

I'm using access & word 2000. I have a form built to run a query then
merge
with word. The query runs as expected, the data is shown in a table,
the
word file with the correct fields is open. However, there is no data
in
the
word file. The mailmerge toolbar is all grayed out. This works once
in a
while, but most often doesn't.

If I do this in reverse order, open word and then mailmerge (dde) the
query,
it works.

Help!

Thanks