views:

1051

answers:

3

I want send an mailmerge word document based on a query from Access database and also add a separate attachment (pdf) and email the merged document as the body of the email and the pdf file as an attachment

A: 

Try using SendMail

Jeff O
A: 
  1. Create your query
  2. Open word choose Tools, MailMerge and follow the wizard until you get to Select Recipients
  3. Under 'Use existing List' click 'Browse'
  4. the select datasource window opens, navigate to the access database file.
  5. your query should show up in the list of available items. Select it an you are on your way.

HTH

Praesagus
+1  A: 

I'm assuming you want to send customized Word files as email attachments to a number of people. For methods of sending the emails and sample code see the Microsoft Access Email FAQ http://www.granite.ab.ca/access/email.htm

1) Create a query with the list of email addresses and other information you want. Then See the Sample Code illustrating looping through a DAO recordset page at the Access Email FAQ at http://www.granite.ab.ca/access/email/recordsetloop.htm

2) Creating PDF files is quite easy. Creating PDF files from within Microsoft Access http://www.granite.ab.ca/access/pdffiles.htm

The best free solution is A2000ReportToPDF is an Access 2000 database containing a function to convert Reports and Snapshot files to PDF documents. No PDF Printer driver is required. Free. http://www.lebans.com/reporttopdf.htm

3) Creating Merged Word files is a bit trickier.
a) If this is Word 2007 and these are .docx files you could update the zipped XML files directly via VBA I've used the open source InfoZip DLLs to zip and unzip files. See Compression DLLs, OCXs, etc http://www.granite.ab.ca/access/compression.htm b) If Word 2003 or earlier or .doc files then the easiest solution is Albert Kallal's Super Easy Word Merge - Scroll down a ways http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html Note though that you want to create one Word file at a time rather than all the files. So you'll need to pass Albert's code just one record in the query.

Tony Toews