How to do a form letter

N

njem

I've worked with Access in years past and just getting up to speed on
2007. I've been reading reams of help files and trying various ways
for hours to make a simple form. I need to pull up a person in the db,
click a button and print one of a list of form letters (reports) to
that person. I've tried creating a letter in Word and embedding it.
Even when I set it "to fit" it is reduced in size. If I stretch it it
looks funny. Regardless I then need to overlay field boxes everywhere
they're needed and try to get them to align with the letter. This also
means fields can't have any following text on that line because the
letter text isn't going to adapt to the field length.

I'm sure I could create a macro to export the selected data to a text
file that Word could use as a merge source, but there are about 100
different letters. So the operator would need to run the export macro,
switch to Word, open the correct letter, merge, then back to Access.
Not very workable to do many times a day in rapid succession.

I really hope I'm missing some easy way to do this. Any suggestions?

Thanks,
Tom

Originally posted in "forms".
 
G

Graham Mandeno

Hi Tom

For a start, DO NOT try to do this by embedding a Word document.

There are two possible approaches, both involving the automation of Word
(calling up its functionality from within Access).

The first is to create a Word template with bookmarks in it at the places
you want the values from your database fields to be filled in. Your code
then creates a new document based on the template, and goes through it
substituting the field value for each of the bookmarks. Then it saves
and/or prints the resulting document. This approach is best for doing a
single record at a time.

The second approach is to create a mail merge master document, containing
merge fields corresponding to your data fields. This approach is best for
generating many letters from a selection of your data. Word can merge
directly from an Access query as its data source, but personally I thing it
is preferable to export the query data set as a delimited text file, and use
that as the merge data source. Your code needs to export the data to a
temporary file, open the Word merge master, set its merge data source, and
then perform the merge, either to a new document which can be edited and/or
saved, or directly to a printer.

Albert Kallal has some example code here:
http://www.members.shaw.ca/AlbertKallal/wordmerge/index.html
 
N

njem

Albert,

Your method looks promising. I downloaded WordMerge20.mdb. When I run
it in Access 2007 nothing works. Probably some setting on my end. Even
the close button doesn't work. I checked the DAO setting as mentioned
on your page. Any ideas?

Thanks,
Tom
 
A

Albert D. Kallal

Albert,
Your method looks promising. I downloaded WordMerge20.mdb. When I run
it in Access 2007 nothing works. Probably some setting on my end. Even
the close button doesn't work. I checked the DAO setting as mentioned
on your page. Any ideas?

Thanks,
Tom

Look at near the top of the application...is there not a "security" warning
about allowing macros code in the application?

change your security settings to low (else, any application with code you
attempt to run will not work).

to change, either click on the options for the above bar, but really, just
go:

office button-> access options (lower right)
-->trust center--->Trust center settings
---->macro settings

check the "enable all macros option"

Now, exit ms-access...and try the application again....
 
N

njem

Look at near the top of the application...is there not a "security" warning
about allowing macros code in the application?

change your security settings to low (else, any application with code you
attempt to run will not work).

to change, either click on the options for the above bar, but really, just
go:

office button-> access options (lower right)
-->trust center--->Trust center settings
---->macro settings

check the "enable all macros option"

Now, exit ms-access...and try the application again....

I seem to be having a heck of a time getting my posts to show up here.
I think this is the third time I've posted or responded, checked hours
later, and no post. So I'm posting again.

My macro setting were set to allow only signed macros. Apparently ones
I made myself in the ap were accepted. But with that setting it gives
no message when other macros are blocked.

Your WordMerge works great. I'm using it in the no-prompt, print-and-
discard mode.

One quirk, the forms came up tiny at first. I viewed them in design
mode, checked there size values, did a save, and then they showed up
very big. I fixed the sizes and then no problem. Maybe something about
2007?

You solved my problem. Thanks,
Tom
 

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