Here is the script that I am using to create the email message:
Private Sub EMail_Report_Click()
On Error GoTo Err_EMail_Report_Click
Dim stDocName As String
stDocName = "error reporting"
DoCmd.SendObject acReport, stDocName
Exit_EMail_Report_Click:
Exit Sub
Err_EMail_Report_Click:
MsgBox Err.Description
Resume Exit_EMail_Report_Click
End Sub
Private Sub ButtonName_Click()
DoCmd.SendObject acReport, "Name of report here", "RichTextFormat(*.rtf)",
"AN...@theweb.com", "Anothe...@theweb.com", "", "Hey - our machine is
broken", "Please will you come and fix our machine as soon as possible.
Thanks", False, ""
End Sub
Or
DoCmd.SendObject acReport, "Labels Jackets_Orders",
"RichTextFormat(*.rtf)", "An...@theweb.com;Anothe...@theweb.com", "", "",
"Hey - our machine is broken", "Please will you come and fix our machine as
soon as possible. Thanks", False, ""
If sending the mail to addresses shown in 2 controls on the form (where the
CC may or may not be empty) - I use the If Not IsNull to stop the errors
caused by the empty address in the code in outllook
Private Sub ButtonName_Click()
If Not IsNull(Me.CCMailAdress) Then
DoCmd.SendObject acReport, "Report Name Here", "RichTextFormat(*.rtf)",
FormName!EMailaddress, Forms!CCMailAdress, "", "Hey - our machine is broken",
"Please will you come and fix our machine as soon as possible. Thanks",
False, ""
Else
DoCmd.SendObject acReport, "Report Name Here", "RichTextFormat(*.rtf)",
FormName!EMailaddress, , "", "Hey - our machine is broken", "Please will you
come and fix our machine as soon as possible. Thanks", False, ""
End If
End Sub
Note the "" before the "Hey - our..... this is the space where the CC would
be in the "Else" case
Hope this helps
--
Wayne
Manchester, England.