Send Email, Outlook fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I've read several posts and could use help setting up automation to
send Access data via email.

I have a report named EmailData. The report has the formatting I'd like to
see in the body of the email.

Right now I'm using a form which works to create the email and populate the
Address fields, but currently the body is a .rtf attachment that shows the
address fields. I'd like to see the EmailData report in that section but
need help adjusting my code. Also, I prefer the report to display with
formatting, not as an attachment.

I have a Macro set up to run using a command button on a form as follows:

Form name: frmMail

Private Sub Command72_Click()

On Error GoTo Err_Command72_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "DistroList"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command72_Click:
Exit Sub

Err_Command72_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command72_Click

End Sub

There is a macro attached to the OnOpen event of the DistroList form with
the following code:

Option Compare Database
Option Explicit

'------------------------------------------------------------
' EmailTemplate
'
'------------------------------------------------------------
Function EmailTemplate()
On Error GoTo EmailTemplate_Err

DoCmd.SendObject acForm, "DistroList", "RichTextFormat(*.rtf)",
Forms!DistroList.EmailAddress, Forms!DistroList.CCAddress,
Forms!DistroList.BCCAddress, Forms!DistroList.Subject,
Forms!DistroList.Verbiage, True, ""
DoCmd.Close acForm, "DistroList"


EmailTemplate_Exit:
Exit Function

EmailTemplate_Err:
MsgBox Error$
Resume EmailTemplate_Exit

End Function

I don't know how to get the EmailData report as the body of the email.
Outlook opens and the address fields populate, but I'm having trouble with
the message body. Even if I could have it as an attachment it would help. I
can open it, copy and paste, then send the email. Still much quicker than
what I'm doing now.

Please help me with this last piece of the puzzle.
Thanks!
Mary
 
Read through the help file on the SendObject Method and SendObject Action. I
think you will have a problem putting your report in the Message Body, though
using SendObject you can easily attach the report in several formats: RTF,
SNP, TXT, XLS.
 
Ok, I've got a macro set up using SendObject and it opens Outlook with the
report attached. I have a combobox on a form to select which email list to
send to. The after update is set to:

Sub Combo89_AfterUpdate()
Me.RecordsetClone.FindFirst "[Name] = '" & Me![Combo89] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

I need to get the combobox to update the subform (that's where the email
list is) and then finish the SendObject macro. Where do I need to add the
AfterUpdate code shown above?

Thanks,
Mary
 
I got this to work the way I wanted...
added a line to the Sub below
DoCmd.RunMacro "mymacroname"

Thanks for all the help in these newsgroups!

Mary said:
Ok, I've got a macro set up using SendObject and it opens Outlook with the
report attached. I have a combobox on a form to select which email list to
send to. The after update is set to:

Sub Combo89_AfterUpdate()
Me.RecordsetClone.FindFirst "[Name] = '" & Me![Combo89] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

I need to get the combobox to update the subform (that's where the email
list is) and then finish the SendObject macro. Where do I need to add the
AfterUpdate code shown above?

Thanks,
Mary

Jeff C said:
Read through the help file on the SendObject Method and SendObject Action. I
think you will have a problem putting your report in the Message Body, though
using SendObject you can easily attach the report in several formats: RTF,
SNP, TXT, XLS.
 
Me again. I'm using a sendobject macro to email the report in rtf format.
Now I've found the To section of the email is truncating, not including all
of the addresses. Is there any way around this?
Thanks, Mary
 
Back
Top