By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,492 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Programming Access mail merge to Word

P: n/a
I have an application that will be distributed remotely. In the
Access application I am opening Word documents and mail merging. The
Word documents are linked to a tmpLetter table. In my code I write
the records to be merged into that table. The Word documents are
using a system dsn (ODBC) to connect to the data source. In my code I
simply open the Word documents after writing to the table do a mail
merge and print.

It runs pretty quick and I like it but alas my problem in creating a
setup program using Access I cannot create registry entries. The way
I am doing it won't work unless I create the system dsn in code or
have the user do it. I don't know if I want to do that.

I am also offering the user the option of exporting the records into
Excel so I pretty much have to use a temp table to do that. So even
if I were to do it a different way like with Word bookmarks I would
still need this table.

Okay so before I waste a lot of time converting my code to using
bookmarks I am wondering what is good and more importantly what is bad
about using them.

TIA

Tom
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
td*****@bu.edu (Tom Dauria) wrote in message news:<56**************************@posting.google. com>...
I have an application that will be distributed remotely. In the
Access application I am opening Word documents and mail merging. The
Word documents are linked to a tmpLetter table. In my code I write
the records to be merged into that table. The Word documents are
using a system dsn (ODBC) to connect to the data source. In my code I
simply open the Word documents after writing to the table do a mail
merge and print.

It runs pretty quick and I like it but alas my problem in creating a
setup program using Access I cannot create registry entries. The way
I am doing it won't work unless I create the system dsn in code or
have the user do it. I don't know if I want to do that.

I am also offering the user the option of exporting the records into
Excel so I pretty much have to use a temp table to do that. So even
if I were to do it a different way like with Word bookmarks I would
still need this table.

Okay so before I waste a lot of time converting my code to using
bookmarks I am wondering what is good and more importantly what is bad
about using them.

TIA

Tom


You could use Albert Kallal's code... there's a pretty good discussion
about merging using bookmarks in ADH2000, so I'm sure it's in 2002 and
probably previous versions. The good thing about bookmarks/tables is
that you can merge both the 1 side and the many side of a relationship
(like an invoice).
Nov 12 '05 #2

P: n/a
I never liked bookmarks, but a some people have made some very good points
about using them.

Thus, I kind of created a anti bookmark crusade, when none such bad things
should be said about bookmarks. However, I don't like bookmarks much, and I
do think they are bit hard to work with in a document. At the end of the
day, much of this dis-like is really is just my feelings. I would actually
say that bookmarks are very reliable solution.

However, I do suggest you give my sample merge code a try. It is ready to
go, and should work well. My sample code is very good if you plan to
distribute your code, as it is all late binding, and fixes many word merge
bugs that I have encountered. Thus, the sample code has been tested on a lot
of pc's. Any feedback I get has been used to fix bugs.

Give my sample a try. It just might be what you are looking for:

http://www.attcanada.net/~kallal.msn.../msaccess.html
--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
ka****@msn.com
http://www.attcanada.net/~kallal.msn


Nov 12 '05 #3

P: n/a
"Albert D. Kallal" <NO************@msn.com> wrote in message news:<YpJkb.132556$pl3.102649@pd7tw3no>...
I never liked bookmarks, but a some people have made some very good points
about using them.

Thus, I kind of created a anti bookmark crusade, when none such bad things
should be said about bookmarks. However, I don't like bookmarks much, and I
do think they are bit hard to work with in a document. At the end of the
day, much of this dis-like is really is just my feelings. I would actually
say that bookmarks are very reliable solution.

However, I do suggest you give my sample merge code a try. It is ready to
go, and should work well. My sample code is very good if you plan to
distribute your code, as it is all late binding, and fixes many word merge
bugs that I have encountered. Thus, the sample code has been tested on a lot
of pc's. Any feedback I get has been used to fix bugs.

Give my sample a try. It just might be what you are looking for:

http://www.attcanada.net/~kallal.msn.../msaccess.html


Albert,

one question - if you're merging a 1-M situation, as is done in ADH,
how would you do that with your code? The problem I see with creating
a textfile is that how do you put all of those values into a table in
Word? Is it possible? If you don't have a set of incorporated child
records in your mail merge, then use Albert's method. It's quick,
easy, and clean. But if you have to sort of collapse a 1-M into the
form letter, I don't think you can use it. Or can you, Albert? If
so, how?

Thanks,
Pieter
Nov 12 '05 #4

P: n/a
"Pieter Linden" <pi********@hotmail.com> wrote in message

Albert,

one question - if you're merging a 1-M situation, as is done in ADH,
how would you do that with your code? The problem I see with creating
a textfile is that how do you put all of those values into a table in
Word? Is it possible? If you don't have a set of incorporated child
records in your mail merge, then use Albert's method. It's quick,
easy, and clean. But if you have to sort of collapse a 1-M into the
form letter, I don't think you can use it. Or can you, Albert? If
so, how?


My solution does not handle the above problem. In fact, my solution does not
even have to have code that scans and re-places bookmarks. Thus, my code
solution is generic, and allows you to word enable any access form with one
line of code. Thus, my solution is NOT hard coded. I am considering adding
some code to handle the 1-M situation. (packing data on one line with Carrie
Returns is a possible solution. (so, I would just specify what fields are to
have more then one line of data. Hence, I am considering adding some code to
perhaps use a word table, but I again want a generic solution (no hard coded
fields). Right now, you can merge a multi-line access field with a text
file, and thus my solution does handle that. I just don't have any code to
put that stuff into a table. (but as mentioned, I am going to add this
feature).

So, using a text file does not eliminate the possibility of multi-line data
for each record.
--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
ka****@msn.com
http://www.attcanada.net/~kallal.msn

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.