How do you alter the default SQL statement for a mail-merge templa

R

Roy

I use mail-merge in a bit of a non-traditional way. Rather then producing
the merged documents, I use the mail-merge setup document to save time
entering address and contact information on a single letter of transmittal,
contract, etc. I then enter information specific to the transmittal or
contract for that contact and I finally print the single document.

The process is repeated for as many transmittals or contracts I need to
produce at a given point in time. This process is appropriate because I only
print a very small subset of my master list of contacts, and the subset
varies each time.

The process uses the standard Mail Merge toolbar rather than VBA macros.
The "Show Fields/Values" button allows the currently selected data source
record values to be shown on the mail merge setup document and the Find Entry
button allows me to find the contact info to display.

What worked smoothly in Word 2000 has issues in Word 2003.

A new dialog box appears when the mail-merge setup document is opened. It
says:

"Opening this document will run the following SQL command:
SELECT * FROM P:\Data Source.doc
Data from your database will be placed in the document. Do you want to
continue?"

After clicking Yes, the process does not work as it did in Word 2000. When
you click the Find Entry button, you can see a "Word is searching record ..."
dialog until the data base search is complete. It does not find any records.

I discovered it is not working because the Data Source.doc file is not a
sorted database. Word 2000 must have sorted it automatically. In word 2003,
I need to manually sort the data source to get it to work.

I am getting around the problem by clicking the Mail Merge Recipients button
and then clicking on the “Company†column heading to sort the data source by
Company. After that extra step, the mail-merge setup document works exactly
as it did in Word 2000.

I could make the process run automatically as it did under Word 2000 if I
could change the default “SELECT * FROM P:\Data Source.doc†statement to
include a sort by Company name. I have found no documentation on how to
change this default SQL data selection statement.
 
D

Doug Robbins - Word MVP

See the following Knowledge Base article:

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

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

You might also select Toolbars from the View menu and check the Mail Merge
item to display the Mail Merge toolbar as that will probably make it easier
to do what you are doing.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
R

Roy

The article referenced just tells how to suppress the message. I want to use
a different default SQL statement to sort the data source without having to
do it manually.
 
D

Doug Robbins - Word MVP

Why don't you just open the data source, sort it on the Company Name field
and then save it?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
B

Boris

Hello!

Roy, I have the same problem here. I want to connect to my
database via ODBC. Everything works fine, except this find entry in
word 2003. Did you find any solution?

thank you for answer.

regards

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 
P

Peter Jamieson

It helps to quote the message you are replying to.

I searched for "Roy" and "ODBC" in this group using Google Groups and came
up with the following conversation, in which Roy's question was answered by
Doug Robbins (you may have to reconsistute the link, and of course Roy's
question may not have been your question, exactly):

http://groups.google.co.uk/group/mi...6f595d13b49?lnk=st&q=&rnum=1#2fc376f595d13b49

If you were referrring to a different Roy/ODBC question, maybe you could
provide a reference.

Peter Jamieson
 

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