Good Afternoon,
I want to have a command button that when clicked it will send e-mails to all recipients based on a query results. When I click on the command button i get the following error:
run time error 2295
unknown message recipients; the message was not sent
Private Sub Command92_Click()
Dim mydb As DAO.Database
Dim rsEmail As DAO.Recordset
Dim stoName As String
Dim sSubject As String
Dim smessagebody As String
Set mydb = CurrentDb()
Set rsEmail = mydb.OpenRecordset("qryexcludednoemail", dbOpenSnapshot)
With rsEmail
.MoveFirst
Do Until rsEmail.EOF
If IsNull(.Fields(0)) = False Then
stoName = .Fields(0)
sSubject = "Excluded time requested for: " & .Fields(2)
smessagebody = "The following excluded time requested: " & .Fields(2)
DoCmd.SendObject acSendNoObject, , , stoName, , , sSubject, smessagebody, False, False
End If
.MoveNext
Loop
End With
Set mydb = Nothing
Set rsEmail = Nothing
End Sub