Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sending an Access report to specific email addresses?

13 views
Skip to first unread message

Pauli G

unread,
Oct 1, 2007, 9:46:25 AM10/1/07
to
Hello,
I'm creating an MS Access form for employees to use when reporting
errors with our GIS (geographic information systems) data. One
option I'd like to add to the form is the ability to automatically
email an error report to the GIS personnel so that they instantly know
when there's a data error/issue. I've been able to figure out how to
make a button that creates an Outlook message with an attachment of
the error report, but I'd like for this email message to automatically
have two email addresses populated in the "To:" field of Outlook. I'm
just not sure how to do this.

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

Wayne-I-M

unread,
Oct 1, 2007, 10:49:04 AM10/1/07
to
If sending to the same e mail addresses all the time

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.

0 new messages