for the moment I am using this code to send the report to a given user
but I want the code to search for every email in the table and send to each of them the report with their open po`s.
Code:
Private Sub cmdEmailList_Click()
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim db As DAO.Database
Dim fs, f
Dim RTFBody, strTo
Dim objOutlookRecip As Outlook.RECIPIENT
Dim MyOutlook As Outlook.Application
Dim MyItem As Outlook.MailItem
'DoCmd.OutputTo acOutputReport, "Report1", acFormatRTF, "Report1.rtf"
DoCmd.OutputTo acOutputReport, "VENDOR", acFormatHTML, "C:\Users\me\vendor.htm"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("C:\Users\ME\vendor.htm", ForReading)
'Set f = fs.OpenTextFile("Report1.rtf", ForReading)
RTFBody = f.ReadAll
f.Close
Set MyOutlook = CreateObject("Outlook.Application")
Set MyItem = MyOutlook.CreateItem(olMailItem)
With MyItem
.To = "ME@ME.COM"
.Subject = "Dispute Update"
.HTMLBody = RTFBody
End With
MyItem.Display
End Sub