Sending Lotus Notes Email with Report as attachment

Posted on 2006-05-05
Last Modified: 2006-11-18
I have a form that opens on startup within an MS Access DB.  Within the VB coding of the form I send an email by calling an email function on open.  The email function that I used I copied from this link <>.  I also have a timer on the form to automatically quit the MS Access DB in half a second.  I then have this DB opened with the Windows event scheduler weekly at a specific time.

Basically, I have created a process that runs every Friday at 7:00 AM to automatically send an email by using MS Access provided they are logged into the network under their user name and have Lotus Notes open.  Everything is working great.  I have created this process so certain users will receive an Access Report weekly through their email.

Here is my question.  I want to attach a report in the email as a .SNP file.  How can I do this using what I currently have by possibly re-writting the code or something?  The code asks for a string attachment but this doesn't work for an Access report.  I realize there is a SendObject command within Access but it doesn't send the email automatically.  It just opens the new memo requiring the user to hit send.  I have tried this method switching the EditMessage from true/false and it doesn't send automatically either way.  Thanks
Question by:drakebcbsks
    LVL 11

    Expert Comment

    Add this somewhere in your code:

    NewMessage.Attachments.Add "[Path]:\FileName.snp", olByValue

    Author Comment

    That requires that the report is ran and saved as a .SNP to a file location.  I could probably write some code to automatically do that, but it would be easier if I can figure out what I originally asked.  I essentially want this to work like the SendObject function but have it automatically sent.
    LVL 11

    Accepted Solution

    Just include a line of code that runs and saves the report prior to the automatic email:

    DoCmd.OutputTo acOutputReport, "ReportName", "SnapshotFormat", [Path]:\FileName.snp"


    Author Comment

    I did get it to work finally after a little alterations.  I found the email function wanted a .RTF format not .SNP.  So I created one by this using this code:

    DoCmd.OutputTo acOutputReport, "RTest", acFormatRTF, "[Path]:\RTest.rtf"

    So in the Attachment part of the call [SendNotesMail(Subject As String, Attachment As String, Recipient As String, BodyText As String, SaveIt As Boolean)], I entered "[Path]:\RTest.rtf" and it worked great without altering any coding in the function.  Thanks for giving me a little different light to see it with.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    In the previous article, Using a Critera Form to Filter Records (, the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now