Replace Sorce of data in MSWord merge document

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

david epsom dot com dot au

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)
 
M

MichaelK

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
 
J

John Nurick

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.
 

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