Generate reports directly to Email

J

JR Hester

Access 2007 on WinXP with Outlook 2007 and Exchange server 2003

I have a operational report based on a query using a temprary variable to
acquire start and ends dates for the report. Searches in the forum led me to
trying the following code in the RUN line of a switchboard option box.

DoCmd.SendObject acReport,"rpt ConfirmationLetter4testing*",
acFormatRTF,"ContactNumber",,,"test confirmation",,True

I keep getting a dialog box upon execution stating " There was an error
during execution"

rpt ConfirmationLetter4testing* functions as expected when ran independently
of the option button.

Any suggestions how I might direct each report to teh email address included
in the Query will be appreciated.

Thank you,
 
M

Mark Andrews

You could use our email module code
http://www.rptsoftware.com/products/email/
By default it uses the Ostrosoft smtp component
- it has custom email templates
- useful functions for batch creation of files

Or code it yourself.
In general you are looping thru a recordset and for each record:
- building the email (to, from, subject, body etc...)
- adding the attachment
- sending the email
- recording history of emails that were sent out, or recording the error
that occurred during sending the email
if using Outlook dealing with any security errors etc...

You can use Outlook automation if you like that better than the little
Ostrosoft dll.
I prefer not relying on certain software packages to be installed. Having
one extra file
doesn't bother me too much.

HTH,
Mark Andrews
RPT Software
http://www.rptsoftware.com
 
T

Tony Toews [MVP]

Note that the RTF format isn't perfect and indeed can get quite ugly.
Creating PDF files is strongly urged.
Any suggestions how I might direct each report to teh email address included
in the Query will be appreciated.

Microsoft Access Email FAQ
http://www.granite.ab.ca/access/email.htm

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
 

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