View Single Post
  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default Different Results when merging

Strictly speaking, you should only need to set up the connection once,
before you distribute your code. But there are some gotchas:
a. fairly recent "security-related" changes mean that Word tends to prompt
the user whenever it opens a document connected to a data source, and/or to
fail to re-make the connection, unless the user's registry is patched. (see

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

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

). This is particularly problematic if you have no simple way to patch the
registry for every user.

b. For ODBC connections, you will either have to ensure that every user of
your document has the correct DSN ("User" or "System") on their system, or
distribute a "file DSN". User/System DSNs can be created programmatically if
necessary, but if all your users already have a standard DSN for your data
source it will help. For OLEDB connections you will have to distribute
either a Datalink file (.udl) or Office Database Connection File (.odc)
file. The .odc can be a completely empty file as all the conneciton info.
can be passed in the OpenDataSource method.

You will need to use the OpenDataSource method call to connect to the
database. If you search this group in Google groups for, e.g. Jamieson
OpenDataSource ODBC OLEDB you may find further info. on how to do that.

Peter Jamieson
"Carol" wrote in message
oups.com...
Thanks, Peter. I had a feeling I was going to end up going directly to
the data and using VBA. But I was trying to find a way around having
to patch the application (which is distributed to lots of folks) and
that's why I started from Word itself.

However, I just figured out how to pass a parameter into a query via
VBA so when I do write the patch, All I'll have to do is figure out how
to open Word and run the merge itself through VBA which might be easier
than going the other way.

Thanks for your help. Carol.