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
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