Hello,
The following code emails a department report to the department manager each pay period. The code works great except that it opens each email one at a time, requiring the user to click "send" for each report before it will move on to the next one.
Code:
Private Sub Detail_Click()
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("Current_Dept_List")
If Not rs.BOF And Not rs.EOF Then
While Not rs.EOF
DoCmd.OpenReport "EE_Detail_Distro", acViewPreview, , "labor_worked=" & rs!Labor_worked
DoCmd.SendObject acSendReport, "", acFormatPDF, rs!email, , , "Labor Budget Summary Report"
DoCmd.Close
rs.MoveNext
Wend
End If
rs.Close
End Sub
Since we have over 50 departments, I am trying to save the user time by sending out all reports automatically at once and bypass the requirement of the user to click "send" between each of the 50 emails.
Is there a way to do this by chance? The user email program is Outlook 2016.
Thanks in advance for the help!
Jessica