I have this code in my database to send automated e-mails:-
Sub sendmail()
Dim rsEmail As DAO.Recordset
Dim strEmail As String
Set rsEmail = CurrentDb.OpenRecordset("Master Student Database")
Do While Not rsEmail.EOF
strEmail = rsEmail.Fields("EmailAddress").Value
DoCmd.SendObject , , , strEmail, , , rsEmail.Fields("Matric No").Value, "This is an automated e-mail. Please do not respond", False
rsEmail.MoveNext
Loop
Set rsEmail = Nothing
End Sub
Does anyone know how to change my code so that if there isn't an e-mail address don't send an e-mail?
Many thanks
Sub sendmail()
Dim rsEmail As DAO.Recordset
Dim strEmail As String
Set rsEmail = CurrentDb.OpenRecordset("Master Student Database")
Do While Not rsEmail.EOF
strEmail = rsEmail.Fields("EmailAddress").Value
DoCmd.SendObject , , , strEmail, , , rsEmail.Fields("Matric No").Value, "This is an automated e-mail. Please do not respond", False
rsEmail.MoveNext
Loop
Set rsEmail = Nothing
End Sub
Does anyone know how to change my code so that if there isn't an e-mail address don't send an e-mail?
Many thanks