how to email reports

  • Thread starter Thread starter Rover
  • Start date Start date
R

Rover

I have a form that produces 4 reports. Two of those I want to email
using Outlook. I want them to go to a list of email recipients. I can
do all this by hand but I want this to be in my code with the simple
push of a button for the user. How do I code it to do so?

I'm making some guesses that I would export them in .rtf format but I
don't know what to do from there.

tia

Jim
 
One way is to output the two reports to files and then
Email them. If they are always the same name this would be
fairly easy.

Modify and add this code to a button
Private Sub Command1_Click(
On Error GoTo Err_Command1_Click)

DoCmd.OutputTo acReport, "Report1",
"SnapshotFormat(*.snp)", "c:\Report1.snp", False, ""
DoCmd.OutputTo acReport, "Report2",
"SnapshotFormat(*.snp)", "c:\Report2.snp", False, ""

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = "(e-mail address removed)"
.Subject = "Sample Reports"
.body = "Type message here"
.Attachments.Add "C:\report1.snp"
.attachments.Add "C:\report2.snp"
.Send
'.ReadReceiptRequested
End With

Exit_Command1_Click:
Exit Sub

Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click


Chris
 
Thanks - that's what I was looking for.

One more question. Is there a way to "list Process" this? That is I
want to use a list of email addresses stored in Outlook.
 
I am not sure what you want but you can link to the
contacts folder in Outlook as you would a table.
File/Get external data
Change the file type to Outlook
Select you contacts folder

If you are talking about using the group name that you have
created in Outlook containing a list of email addresses you
can.

Chris
 
I want to use the users group name that they have created in Outlook and
send my reports to all the email addresses in that group.
 
Where the email address goes use that group name. I have
done this and it works.

Chris
 
Back
Top