automatic email merge using addresses from multiple fields?

J

JDDS

I have a mail merge document set up to pull info from Access into a form
letter. I'd like to automatically e-mail the letter to each of 4 addresses
included in separate columns in each record. The only obvious way I could see
to do an automatic mailing either directly from mail merge or to a .pdf only
gives the option of selecting one column of the record to send to. I created
a new column in the query concatenating all the addresses with the usual
semicolon separator, but outlook wouldn't recognize them as separate
addresses. Any ideas?
 
D

Doug Robbins - Word MVP

You are going to need to use some Visual Basic code that makes use of the
Outlook Object Model.

You should be able to glean what you want from the following articles:

"Mail Merge to E-mail with Attachments" at

http://word.mvps.org/FAQs/MailMerge/MergeWithAttachments.htm

and

"How to send an email from Word using VBA" at:

http://www.word.mvps.org/FAQs/InterDev/SendMail.htm




--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
P

Peter Jamieson

If you have to have all the addressees on one e-mail, then you have to
automate Outlook as Doug says. There doesn't appear to be any syntax that
lets you concatenate multiple addresses in the To field during a Word Mail
merge.

As long as it's OK to send one e-mail to each address, another possibility
wmight be to create the data source you need in Access, e.g. using a UNION
query. So for example iff your address fields in Access are called
a1,a2,a3,a4 the UNION query might be something like

SELECT a1 AS a, * FROM mytable WHERE a1 <> ""
UNION
SELECT a2 AS a, * FROM mytable WHERE a2 <> ""
UNION
SELECT a3 AS a, * FROM mytable WHERE a3 <> ""
UNION
SELECT a4 AS a, * FROM mytable WHERE a4 <> ""

(You may need to use other conditions in the WHERE, e.g. WHERE a4 <> "" AND
a4 IS NOT NULL, and the syntax may need correcting)

You probably won't be able to use that query directly as a data source, but
you can either
a. save the query results as a new table
b. use that table as the data source for the merge
c. delete the table
or
d. try creating another query that does

SELECT * FROM theNameOfTheUnionQuery

and use that as the data source

Peter Jamieson
 

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