Email multiple attachments - again!

reglarh

Registered User.
Local time
Today, 02:20
Joined
Feb 10, 2014
Messages
118
This has been covered in several threads, but unless I am missing something not quite in the way I need. I have set up a facility to take a report and filter it to send a page to each group leader listing the students in his group. I first set up a query to generate the list of group leaders and the group codes and then cycle through this to send an email to each group leader with just his group members attached. I now need to send extra attachments, a PDF document and a Word document along with the filter report. These extra document are identical for each group leader.

The facility I use (code attached) does not support multiple attachments. How can I change this to achieve my needs?
 
Seem to have lost the attachment last time!

Private Sub Command0_Click()

Dim dbName As Database
Dim rst As Recordset
Dim zWhere As String
Dim zMsgBody As String
Dim zEmail As String
Dim zFirstname As String
Dim zSubject As String
Dim zMessage As String
Dim zDocname As String
zDocname = "Group Membership"
Set dbName = CurrentDb()
Set rst = dbName.OpenRecordset("GroupLeaderEmail")
rst.MoveFirst



Do While Not rst.EOF


zWhere = "[GroupCode] = " & Chr(34) & (rst![GroupCode]) & Chr(34)
zDocname = "GroupMembership"
zFirstname = rst![FirstName]
DoCmd.OpenReport zDocname, acPreview, , zWhere
zEmail = rst![PrivateEMail]

zSubject = "Group Membership Audit"
zMessage = "Dear " & zFirstname & vbNewLine & vbNewLine & "It's that time again! Please mark up any changes in your group membership and return to me." & vbNewLine & vbNewLine & "Regards, Peter"
DoCmd.SendObject acSendReport, , acFormatRTF, Reports![GroupMembership]![PrivateEMail], , , zSubject, zMessage, True
DoCmd.Close acReport, zDocname, acSaveNo

rst.MoveNext '*** Move to Next Record ***
Loop


Set rst = Nothing '*** Close RecordSet ***


End Sub
 
You could scroll to the bottom of the page and look at Similar threads
 
I think you probably cannot use send object, as that takes an object, and emails it.

instead you have to work the other way. effectively manage an Email object: set the recipient, the subject, body, etc and add whatever attachments you require - so you need to get some familiarity with interfacing with your email client.
 

Users who are viewing this thread

Back
Top Bottom