Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attach a MS Access report to email generated by VBSendMail

Status
Not open for further replies.

jlitondo

MIS
Jun 27, 2000
175
US
Hi everyone,
Is there a way to directly attach a MS Access report to an email generated by the VBSendMail dll without first saving it to a directory?
The dll requires that a file/report be saved on disk before it can be attached but it would be nice to directly attach the report from access without first saving a hard copy of it.
Anyone done this before? Thanks.



 
I doubt that it is possible to attach a ms access report to an outgoing email without first saving it to disk using this method. If you use outlook as the mail client, then it can be done.
However, the other thing that can be done is to dump the report's data directly to the outbound message, either by first saving it to a temporary table or by fetching the data directly. You would have to predefine the output formating yourself somewhere in your code.

 
One other thing, if saving the report to disk is the way you go, and if running across a network, you may have to use win api's to figure out the current user login, and then either create a sub directory under it or save the report in his/her root directory. You'd have to test this first too since network permissions may become an issue.


 
It is possible if you use this code:

DoCmd.OpenReport "yourreport", acPreview, "", "yourfilter"
DoCmd.SendObject acReport, "yourreport", "RichTextFormat(*.rtf)", "", "", "", "yourmailsubject", "", True, ""

DoCmd.Close acReport, "yourreport"

[thumbsup]
MakeItSo

Andreas Galambos
EDP / Technical Support Specialist
Bowne Global Solutions Wuppertal, Germany
(andreas.galambos@bowneglobal.de)
HP:
 
Hello MakeItSo. Your code would only work if you are using Outlook as your mail client. But I am bypassing Outlook all together and using the vbSendMail app which works great except when it comes to directly emailing a report from access the way your code would do.

 
Actually I figured that using sendObjects would save the report to a temporary folder behind the scenes then delete it after attaching it to the email.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top