473,511 Members | 15,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programming Access mail merge to Word

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
4 8854
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
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
"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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3692
by: Ecohouse | last post by:
I have a computer with XP on it. I loaded Office 97 first because I needed Access 97 for some work. I then loaded Office 2000. Everything seemed to be running fine. But I have come across a few...
9
4310
by: Neil Ginsberg | last post by:
I have a strange situation using Access to automate a Word mail merge. Using Access 2000 and Word 2000, the code opens Word, opens the document in Word, sets a table in the calling Access...
3
2340
by: Strasser | last post by:
In Access2000 mass emailing worked perfectly (very powerful tool!). Doesn't work when using XP version of both Access and Outlook, even though I checked the box to ensure that I was sending the...
3
5569
by: Andy Davis | last post by:
I have set up a mail merge document in Word 2003 which gets its data from my Access 2000 database. I want to set up a button on a form that: 1. runs the query to provide the dat for the merge...
0
2163
by: Linda Cacina | last post by:
Hello all you fine folks, Here is some code I am using to merge data from a single record Access 2K3 table into a NEW word document based on a pre-defined Word merge template doc. All I want to...
4
7462
by: pmhaupt2 | last post by:
I developed an Access 2003 program that will allow the user to produce a group of Word letters that merge with data records from an Access database. I created a mail merge Word document and...
8
13322
by: Ron B | last post by:
Help!!! What am I doing wrong? I am working with Office 2003 and am trying to create a command button on an Access form that will create a mail merge in Word from an Access table. I want to...
6
4631
by: crealesmith | last post by:
Firstly, I have no problem with mail merging to Word, VB code for that works perfectly. On one mail merge I need to merge 15 fields of data that are from 3 seperate records. The 3 records are all...
1
6528
by: Esther Lane | last post by:
Hello! First off, many many thanks to Albert who wrote the Mail Merge code for MS Access I am using. It has been working beautifully for a few years. However, my client just (without notice!)...
0
7252
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7371
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5077
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.