Replace Sorce of data in MSWord merge document

  • Thread starter Thread starter MichaelK
  • Start date Start date
M

MichaelK

I'm opening merge a Word document from Access.

I can keep the same Query as a source of data for fields in the document
and just replace the body of the query.

Is there a way to change the Query name as the source of data for merging on
the fly from the Access? If so then how to do it in VBcode?

Thanks,
Michael.
 
To change the body of a query:

application.querydefs("myquery").sql = "Select * from tbl"

You can also set the Word merge datasource before doing the merge.
You need to ask in a Word group to find how to do that.

(david)
 
Thanks David.
I know how to replace query sql.
May be I wasn't clear, I'm looking the way to replace datasource of the Word
document
on the fly while I'm in Access. Don't want to go in the word document and do
it manually.

Regards,
Michael
 
Hi Michael,

I can't remember whether I've ever tried it, but AFAIK you need to
manipulate the Word document's MailMerge.DataSource object or
MailMerge.DataSource.Connect string.
 
Back
Top