View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default where are the code for the sql statement???

The SQL is usually constructed by Word from the criteria specified by
the user. It is stored in

Activedocument.Mailmerge.DataSource.QueryString

This is a read-write property so you can assign a new value to it in the
usual way, e.g. use the Immediate Window to do

Activedocument.Mailmerge.DataSource.QueryString = "SELECT * FROM
C:\NEW_DATA2.DOC"

If you do that, then save the document, the document should "remember"
the data source the next time you open it.

However, assignment to QueryString may not always work. For example, in
some cases (it depends on the type of data source) you may need to
change information in the Connection string, and you can only do that
using the OpenDataSource method.

Peter Jamieson

http://tips.pjmsn.me.uk

On 01/12/2009 10:01, SAM wrote:
Hi!

I have a doc. This doc execute a sql sentence: "select * from c:\new_data.doc". the
"new_data.doc contents one table with five columns and one row with new data, this
data are inserted in the first document with mailmerge?.

I wish edit the sql sentence, but .... where are located? The VBA Editor are empty of
code

Thanks!!!