merging data with ms word letter

  • Thread starter Thread starter JohnE
  • Start date Start date
J

JohnE

I have a situation in which the users want to merge records in a table to a
Word letter template. Once the merge takes place, a field in the table is
updated with the date the merge took place. Then later when the user goes
against the table it is filtered against the empty field records so the newer
records can then be sent the letter and not those that were already sent.
There will be multiple records accessed each time the merge takes place.

I am a bit lost on how to do the merging of the record data into MS Word and
seek the expertise of the group. If there is are any samples/examples to
review, that would be good as well.

Thank you.
.... John
 
Are your users going to merge one record at a time while looking at the
form?

Or, do you have a bunch of records to merge in one shot, and then set the
"lastLetter" date?

I have a nice working sample that does a merge of the current record to
word.

The sample I have can be found here:
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

What is nice/interesting about my sample is that is specially designed to
enable ANY form with ONE LINE of code....

Thus, each time you build a new form, you can word merge enable it with
great ease.

Make sure you read the instructions from above, and you should eventually
get to the following page
http://www.members.shaw.ca/AlbertKallal/wordmerge/page2.html


Note that the merge can also use a query, and thus you don't have to merge
just "one" record..

After the merge occurs, you get a plain document WITHOUT any merge fields,
and this allows the end user to save, edit, or even email the document
(since the merge fields are gone after the merge occurs).

Give the above a try.

The code to set the LastLetterDate field when merge ONE record you viewing
use the above sample would be:

Me!LastLetterDate = date
MergeSingleWord

If you have a bunch of records to merge, you could use:

dim strSql as string

strSql = "select * from tblCustomers where lastLetterDate is null"
MergeAllWord
strSql = "update tblCustomers set LastLetterDate = date where lastLetterDate
is null"
currentdb.Execute strSql

in the above, we simply send all records to the word merge that don't have a
lastLetterDate.
We then execute a command to update the last date field with a date
value....

Which of the above you choose depends on if users do one letter at a time
WHILE looking at a record in a form, or you do a whole bunch of letters in
one shot after entering a whole bunch of new records.
 
Mr Kallal, thank you for the info. Will be hanging on to this info and the
sample you pointed out to me. This should work.
.... John
 
Back
Top