Scope:
I'm working on a project where I must send roughly a thousand individual reports to a thousand different email recipients with .pdf attachment.
I've found some useful info on this site, and I know I'll need to add a table that designates the email address by SHIP_TO_CODE. Then create a form with the email subject, body, etc.. I don't neccessarily have to have the reports saved to a folder; I really just need them emailed to each account.
I was thinking I could modify the code some to accomplish my goal, but I'm not sure what to put. Maybe add a SendObject in there somewhere...?
PLEASE HELP!
CODE that I have now that saves the report to a folder. (I want to modify some to send email attachement instead)
''Module CODE:
Private Sub Form_Current()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("SELECT DISTINCT [SHIP_TO_CODE] FROM [qryWty&PendingData];", dbOpenSnapshot)
Do While Not rst.EOF
strRptFilter = "[SHIP_TO_CODE] = " & Chr(34) & rst![SHIP_TO_CODE] & Chr(34)
DoCmd.OutputTo acOutputReport, "rptDraft", acFormatPDF, "C:\Users\mrutherford\Desktop\ASC Daily Reports" & "\" & rst![SHIP_TO_CODE] & ".pdf"
DoEvents
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub
''Open & Close Event CODE:
Private Sub Report_Close()
strRptFilter = vbNullString
End Sub
Private Sub Report_Open(Cancel As Integer)
If Len(strRptFilter) <> 0 Then
Me.Filter = strRptFilter
Me.FilterOn = True
End If
End Sub
I'm working on a project where I must send roughly a thousand individual reports to a thousand different email recipients with .pdf attachment.
I've found some useful info on this site, and I know I'll need to add a table that designates the email address by SHIP_TO_CODE. Then create a form with the email subject, body, etc.. I don't neccessarily have to have the reports saved to a folder; I really just need them emailed to each account.
I was thinking I could modify the code some to accomplish my goal, but I'm not sure what to put. Maybe add a SendObject in there somewhere...?
PLEASE HELP!
CODE that I have now that saves the report to a folder. (I want to modify some to send email attachement instead)
''Module CODE:
Private Sub Form_Current()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("SELECT DISTINCT [SHIP_TO_CODE] FROM [qryWty&PendingData];", dbOpenSnapshot)
Do While Not rst.EOF
strRptFilter = "[SHIP_TO_CODE] = " & Chr(34) & rst![SHIP_TO_CODE] & Chr(34)
DoCmd.OutputTo acOutputReport, "rptDraft", acFormatPDF, "C:\Users\mrutherford\Desktop\ASC Daily Reports" & "\" & rst![SHIP_TO_CODE] & ".pdf"
DoEvents
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub
''Open & Close Event CODE:
Private Sub Report_Close()
strRptFilter = vbNullString
End Sub
Private Sub Report_Open(Cancel As Integer)
If Len(strRptFilter) <> 0 Then
Me.Filter = strRptFilter
Me.FilterOn = True
End If
End Sub