[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Sending Lotus Notes Email with Report as attachment

Posted on 2006-05-05
4
Medium Priority
?
308 Views
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 <http://www.fabalou.com/VBandVBA/lotusnotesmail.htm>.  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
0
Comment
Question by:drakebcbsks
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:EMCIT
ID: 16617251
Add this somewhere in your code:

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

Author Comment

by:drakebcbsks
ID: 16617312
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.
0
 
LVL 11

Accepted Solution

by:
EMCIT earned 1500 total points
ID: 16617351
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"

0
 

Author Comment

by:drakebcbsks
ID: 16617626
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.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

868 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