Roger's Access Library Homepage
Forum Home Forum Home > Other Download Libraries > MS Access MVP Libraries > Tejpal, A.D.
  New Posts New Posts RSS Feed - Report_SendInMailBody.mdb
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Please consider donating $1 per sample downloaded, (find out why here)


 Post Reply Post Reply
A.D. Tejpal View Drop Down
Microsoft MVP
Microsoft MVP

Joined: 30 Jun 2008
Status: Offline
Points: 192
Post Options Post Options   Thanks (0) Thanks(0)   Quote A.D. Tejpal Quote  Post ReplyReply Direct Link To This Post Topic: Report_SendInMailBody.mdb
    Posted: 07 Jul 2008 at 10:49pm

(Updated on 18-Dec-2008)
Sample Db - Explanatory Notes

    This sample db demonstrates sending an access report by placing it in the body of eMail message.

    Though sending a report as an attachment, using DoCmd.SendObject command is pretty straightforward, including it in the body of eMail itself, requires some extra measures.

    Word and Outlook objects are used in this approach and should therefore be available on sender's computer.

    Two styles are covered, one deals with a single report at a time, while the other provides for sending multiple reports as selected in a list box. Temporary output files are stored in folder named ReportOutput located in the same folder as the sample db. This folder gets created programmatically, if not already existing.

    An important feature is the display of horizontal lines in final HTML output by using line markers (*^*) in the report. This  overcomes a well known limitation otherwise faced in transferring lines from access reports to HTML format. Even though  labels with string of hyphens as caption, could be used as replacement for lines, the final results in that case are not quite satisfactory.

    When an access report is converted to HTML format, it translates to one file per page. While concatenating the contents of these files, care has been taken to eliminate unwanted hyperlink labels (First Previous Next Last) appearing at the bottom of each page.

    In each case, two alternative modes for transferring the report to mail body are demonstrated:
    (a) Output the report pages to HTML files (one file per page), read these files, consolidate the content and assign the same to HTMLBody property of outlook application's mail item object.
    (b) Output the report to word file, save it in HTML format, read this file and assign the content to HTMLBody property of outlook application's mail item object. This method is slower than (a) above, mainly on account of the time taken in opening the word application. Moreover, the text alignment and rendering of horizontal lines (through line markers) is not completely  satisfactory. This method is given from an academic point of view only.

    Note: Each time Outlook is used for sending messages programmatically, the user is required to clear a warning message (informing that some program is trying to send a message through Outlook). If manual intervention in this regard is to be circumvented, third party utility like ClickYes could be used.

Reference required:
    (a) Outlook Object Library
    (b) Word Object Library
    (c) Microsoft Scripting RunTime

Version - Access 2000 file format

Download File >>:  uploads/37/


Back to Top
Sponsored Links

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.