I am using strMail to send an email with an attachment The email address is stored in a table (tblMail) I can populate the To, CC and BCC Anyone know how to add a third To and CC field in the code ? Thanks
Code:
Private Sub CommMail1_Click()
Dim Response As Integer
Response = MsgBox("Do you want to E`mail this ?", vbYesNo, "Continue")
If Response = vbYes Then
Dim strToField, strCCField, strBCCField, strSubject, strMessage, strEmail, strEmailCC, strEmailBCC As String
Dim rsEmail As DAO.Recordset
Set rsEmail = CurrentDb.OpenRecordset("TblMail")
strEmail = rsEmail.Fields("Email").Value
strEmailCC = rsEmail.Fields("EmailCC").Value
strEmailBCC = rsEmail.Fields("EmailBCC").Value
rsEmail.MoveNext
Do While Not rsEmail.EOF
strEmail = strEmail & " ; " & rsEmail.Fields("Email").Value
strEmailCC = strEmailCC & " ; " & rsEmail.Fields("EmailCC").Value
rsEmail.MoveNext
Loop
DoCmd.SendObject acSendQuery, "Qry1", acFormatXLS, strEmail, strEmailCC, strEmailBCC, "Stuff", "Please find stuff" & vbCrLf & vbCrLf & "Please report errors to:" & vbCrLf & " blar blar", False
Set rsEmail = Nothing
MsgBox "Email has been sent"
Else
End If
End Sub