Hi June7, I have spent some time looking at the Do.Cmd items below and familiarised myself with them. I am still having some issues.
The
Code:
DoCmd.OpenReport "RTestReport", , , "StaffID=" & rs!StaffID
does not run...
Is this because I have not set a rsStaffID?
Code:
Public Function SendTestEmail()
Dim rsEmails As Recordset
Set rsEmails = CurrentDb.OpenRecordset("SELECT eMail, StaffID FROM TStaffList;")
While Not rsEmails.EOF
DoCmd.OpenReport "RTestReport", , , "StaffID=" & rs!StaffID
DoCmd.SendObject acSendReport, , acFormatHTML, rs!Email, , , "Test Report", "message", False
DoCmd.Close acRecport, "RTestReport", acSaveNo
rsEmails.MoveNext
Wend
End Function