Hi I am trying to send an email to everyone on my database, upon searching the forum I found the following code but it throws an error "An expression you entered is the wrong data type for one of the arguements"
Private Sub CmdEmail_Click()
Dim rsEmail As DAO.Recordset
Dim strEmail As String
Dim strBody As String
Set rsEmail = CurrentDb.OpenRecordset("QrySendEmails")
Do While Not rsEmail.EOF
strEmail = rsEmail.Fields("Email").Value
strBody = rsEmail.Fields("Body").Value
DoCmd.SendObject , , , strEmail, , , _
"SUBJECT", _
"MESSAGE", _
vbCrLf & vbCrLf & strBody _
rsEmail.MoveNext
Loop
Set rsEmail = Nothing
MsgBox "Emails have been sent"
End Sub
Does anyone have a suggestion for this?
Thanks
Private Sub CmdEmail_Click()
Dim rsEmail As DAO.Recordset
Dim strEmail As String
Dim strBody As String
Set rsEmail = CurrentDb.OpenRecordset("QrySendEmails")
Do While Not rsEmail.EOF
strEmail = rsEmail.Fields("Email").Value
strBody = rsEmail.Fields("Body").Value
DoCmd.SendObject , , , strEmail, , , _
"SUBJECT", _
"MESSAGE", _
vbCrLf & vbCrLf & strBody _
rsEmail.MoveNext
Loop
Set rsEmail = Nothing
MsgBox "Emails have been sent"
End Sub
Does anyone have a suggestion for this?
Thanks