C
cw
I use the following excellent code below from Alex Dybenko to send my report
of all Past Due Tickets via Outlook Body in HTML format to a single
Management email address.
(Here is a summary that works perfectly to send the whole report to one
address)
1) Macro: sendPastDueTickets_Recipient (calls the Module, runs nightly by
Windows Scheduler)
2) Module: modEmailOL_recipient (see code below)
3) Report: rptTicketsPast_Due_Recipient (uses query in #4)
4) Query: qryTicketsPastDue_Recipient (lists each ticket, including the
recipient email address)
Question: How can I alter it to send individual emails to each email address,
for just their tickets only?
- Some "Looping" code that pulls the "Email Address" from the query?
- Then filters the query by that "Email Address", creating the custom report
(s)?
I already have the automated emailing procedure down pat, just need help
getting the report filtered, and the code below to iterate down the list of
email addresses, creating the custom reports.
Thanks,
cw
'-------------------------------------------------------------------
Function exporthtml ()
Dim strline, strHTML
Dim OL As Outlook.Application
Dim MyItem As Outlook.MailItem
Set OL = New Outlook.Application
Set MyItem = Outlook.Application.CreateItem(olMailItem)
Dim strFileName As String
strFileName = Environ("Temp") & "\rep_temp.txt"
If Len(Dir(strFileName)) > 0 Then
Kill strFileName
End If
DoCmd.OutputTo acOutputReport, "rptTicketsPast_Due", acFormatHTML,
strFileName
Open strFileName For Input As 1
Do While Not EOF(1)
Input #1, strline
strHTML = strHTML & strline
Loop
Close 1
' If OL2002 set the BodyFormat
If Left(OL.Version, 2) = "10" Then
MyItem.BodyFormat = olFormatHTML
End If
MyItem.HTMLBody = strHTML
MyItem.To = "(e-mail address removed)"
MyItem.Subject = "Past Due Tickets.."
MyItem.Send
Exit_btnPastDue_Click:
On Error Resume Next
Set MyItem = Nothing
Set OL = Nothing
End Function
of all Past Due Tickets via Outlook Body in HTML format to a single
Management email address.
(Here is a summary that works perfectly to send the whole report to one
address)
1) Macro: sendPastDueTickets_Recipient (calls the Module, runs nightly by
Windows Scheduler)
2) Module: modEmailOL_recipient (see code below)
3) Report: rptTicketsPast_Due_Recipient (uses query in #4)
4) Query: qryTicketsPastDue_Recipient (lists each ticket, including the
recipient email address)
Question: How can I alter it to send individual emails to each email address,
for just their tickets only?
- Some "Looping" code that pulls the "Email Address" from the query?
- Then filters the query by that "Email Address", creating the custom report
(s)?
I already have the automated emailing procedure down pat, just need help
getting the report filtered, and the code below to iterate down the list of
email addresses, creating the custom reports.
Thanks,
cw
'-------------------------------------------------------------------
Function exporthtml ()
Dim strline, strHTML
Dim OL As Outlook.Application
Dim MyItem As Outlook.MailItem
Set OL = New Outlook.Application
Set MyItem = Outlook.Application.CreateItem(olMailItem)
Dim strFileName As String
strFileName = Environ("Temp") & "\rep_temp.txt"
If Len(Dir(strFileName)) > 0 Then
Kill strFileName
End If
DoCmd.OutputTo acOutputReport, "rptTicketsPast_Due", acFormatHTML,
strFileName
Open strFileName For Input As 1
Do While Not EOF(1)
Input #1, strline
strHTML = strHTML & strline
Loop
Close 1
' If OL2002 set the BodyFormat
If Left(OL.Version, 2) = "10" Then
MyItem.BodyFormat = olFormatHTML
End If
MyItem.HTMLBody = strHTML
MyItem.To = "(e-mail address removed)"
MyItem.Subject = "Past Due Tickets.."
MyItem.Send
Exit_btnPastDue_Click:
On Error Resume Next
Set MyItem = Nothing
Set OL = Nothing
End Function