Defining the DataSource for MailMerge

C

Christof Nordiek

I want to make a MailMerge using SQL-Server as the Datasource.
Is there any way to set the Datasource-information progammatically without
using a .dsn file or something like that?
thanks
 
C

Cindy M -WordMVP-

Hi Christof,
I want to make a MailMerge using SQL-Server as the Datasource.
Is there any way to set the Datasource-information progammatically without
using a .dsn file or something like that?
As far as I know, when talking about ODBC the answer is "no". For Word 2002
and 2003 an OLE DB connection can be used, and *maybe* you can get that to
work without creating a *.odc file.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
C

Christof Nordiek

Hi Cindy,
thanks.
Is there anyway to configure the odc-file programmatically?
My goal is, to provide the provide the connection-information by the
application, so i have less points wher to configure if the database server
is moved by example.
 
C

Cindy M -WordMVP-

Hi Christof,
Is there anyway to configure the odc-file programmatically?
My goal is, to provide the provide the connection-information by the
application, so i have less points wher to configure if the database server
is moved by example.
An odc file is pure text; a special kind of XML file (OfficeDataConnection).
Sometimes a connection requires it, sometimes it doesn't. My suggestion would
be to try recording a connection to the data table in a macro, in Word, then
look at the resulting code. The locate the odc file ("My Data" folder) and see
just how machine/user/server specific it is. You can also test whether the
recorded code works with a new document, and whether it works even if you
remove the odc file.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
C

Christof Nordiek

Hi Cindy,

Thanks for your answer.
It doesn't work. The Makro doesn't even work in the same document.
Says something like 'not enough fields in record n' three times, then it
shows the totally wrong fieldnames.

If the file doesn't exist it says 'file not found', so the file creation is
not recorded in the Macro.
 
C

Cindy M -WordMVP-

Hi Christof,
It doesn't work. The Makro doesn't even work in the same document.
Says something like 'not enough fields in record n' three times, then it
shows the totally wrong fieldnames.

If the file doesn't exist it says 'file not found', so the file creation is
not recorded in the Macro.
I can only make two further suggestions (well 2.5):

1. Go to the word.mailmerge.fields newsgroup and ask there. Look especially
for contact with Peter Jamieson, who's done some research in this area. He may
be able to at least better explain the whys.

2. Submit feedback at the msdn/microsoft website about your need for ODC- and
DSN-less connections. If your company has a "big-time" license, also contact
Product Support and force them to think about the problem a bit :)

If no solution is forthcoming within your time-frame (something I rather
suspect will be the case), the following work-arounds occur to me:

1. Don't use mail merge. Provide the functionality through automation of Word
and feed in the data directly.

2. LINK the SQL tables into either Excel or Access and use either of these as
the data source.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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