Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
sam sam is offline
external usenet poster
 
Posts: 4
Default where are the code for the sql statement???

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!!!

  #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!!!

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing a User Form using an If statement field code Brenda A. Reid[_2_] Mailmerge 2 August 13th 09 04:13 AM
Inserting merge code into an If...Then statement Veteran of the software cycles Mailmerge 4 March 19th 09 03:15 PM
MS Word 2003 Case statement code [email protected] Microsoft Word Help 4 December 28th 06 05:18 PM
which statement right , question isChoose the correct statement? how many template?when we click new doc Microsoft Word Help 1 October 15th 06 11:20 PM
Including a Merge Code Within an IF Statement bk Mailmerge 1 October 4th 05 06:06 AM


All times are GMT +1. The time now is 03:51 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"