Help with adding a report in Body of Email (1 Viewer)

duckster

Registered User.
Local time
Yesterday, 19:05
Joined
Jul 17, 2004
Messages
78
Hi all, I have created an Email button on a form, which automatically opens Outlook once pressed, and attaches a report (rpt_Form1) to the email.

My problem is that I want to have the report in the body of the email (as opposed to an attachment). I've searched this topic and found some help; however, all require a pretty good understanding of vba which I do not have (the below code was basically a cut/paste job from this forum). Below, I've pasted the coding I am currently using, but do not know what to change to have the report (rpt_Form1) show up in the body instead of an attachment. Help is much appreciated!

My current coding (which only attaches the rpt_Form1) in Outlook:
---
---
---


Private Sub CommandEmail_Click()

Dim strMsg As String, strTitle As String
Dim intStyle As Integer
Dim StrCriterion As String
Dim strMailto As String
Dim strDocName As String

If Me.Dirty Then
Me.Dirty = False
End If

If IsNull(Me!Email2) Or Me!Email2 = "" Then
strMsg = "This client has no email address."
strTitle = "E-Mail Error"
intStyle = vbOKOnly
MsgBox strMsg, intStyle, strTitle

Exit Sub
End If

Me.Visible = False

StrCriterion = " [ControlID]=" & Forms![Frm_Questionnaire].[ControlID]
DoCmd.OpenReport "Rpt_Form1", acPreview, , StrCriterion

DoCmd.Minimize

strMailto = Me.Email2
strDocName = "Rpt_Form1"
strSubject = "Your Refund Has Been Processed"
DoCmd.SendObject acReport, strDocName, "RichTextFormat(*.rtf)", strMailto, "", "", strSubject, , True, ""

End Sub
 

Sergeant

Someone's gotta do it
Local time
Yesterday, 22:05
Joined
Jan 4, 2003
Messages
638
You basically need to export it as HTML in a temp location, and then use that to create your email body.
Check out this post.
 

Users who are viewing this thread

Top Bottom