Link to home
Start Free TrialLog in
Avatar of drakebcbsks
drakebcbsks

asked on

Sending Lotus Notes Email with Report as attachment

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
Avatar of EMCIT
EMCIT

Add this somewhere in your code:

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

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of EMCIT
EMCIT

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.