lookforsmt
Registered User.
- Local time
- Today, 12:02
- Joined
- Dec 26, 2011
- Messages
- 672
Hi! I am trying to send email to multiple recipients, but it only sends to one email address.
the code that i am using on the on-click is
I want the code to send to multiple recipients if the criteria is "True"
Any help pls
the code that i am using on the on-click is
Code:
Private Sub cmdMail_Click()
Dim mess_body As String, StrFile As String, strPath As String
Dim appOutLook As Object
Dim MailOutLook As Object
Dim rs As dao.Recordset
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(0)
Set rs = CurrentDb.OpenRecordset("Select * from Mail where Mail.chk=True")
' Set rs = CurrentDb.OpenRecordset("SELECT mail.id FROM mail WHERE mail.chk = " & True)
'~~> Change path here
strPath = "E:\Test Folder1\Reports\"
With MailOutLook
For i = 1 To rs.RecordCount
If rs.Fields("chk") = True Then Else
.To = rs.Fields("email_ID").Value
rs.MoveNext
Next i
.Subject = "Report"
.HTMLBody = "Report"
'~~> *.* for all files
StrFile = Dir(strPath & "*.*")
Do While Len(StrFile) > 0
.Attachments.Add strPath & StrFile
StrFile = Dir
Loop
'.DeleteAfterSubmit = True
.Send
End With
MsgBox "Reports have been sent", vbOKOnly
End Sub
I want the code to send to multiple recipients if the criteria is "True"
Any help pls