Add Attachment to E-mail

Haynesey

Registered User.
Local time
Today, 02:01
Joined
Dec 19, 2001
Messages
190
Hi,

I can get Access to automatically send a report in an e-mail using the following code. However, is it possible to add into the code a line to pick up an attachment as well as the report from a file path?

Dim strText As String
Dim SubjectLine As String
Dim EmailAddress As String
Dim Msg, Style, Title, Response
Dim Capita As String
Dim stDocName As String
stDocName = "rptAcademyReport"


Msg = "Do you want to send call report to Academy?"
Style = vbYesNo + vbDefaultButton2
Title = "Email Confirmation"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then

EmailAddress = "lee@derby.co.uk"
Capita = [Forms]![frmHD]![CapitaID]

SubjectLine = "Derby Homes Help Desk Call "
DoCmd.SendObject acReport, stDocName, "RichTextFormat(*.rtf)", EmailAddress, , , SubjectLine, _
"Please log this call and return details to sender." & vbCrLf & vbCrLf & "Internal Reference: " & Capita, True

Exit_cmdEmailrptAcademyReport_Click:
Exit Sub

Err_cmdEmailrptAcademyReport_Click:
If Err.Number = 94 Then
MsgBox "Data is incorrect or missing"
End If
End If

End Sub

Thanks in advance

Lee
 

Users who are viewing this thread

Back
Top Bottom