Reputation: 307
I have an access report which is modified by a SQL statement so that one report to corresponding recipient is generated. I am using CDO in my VBA code in access 2007. I am interested in taking this report and emailing it. How can I make the HtmlBody have the access report?
Upvotes: 2
Views: 706
Reputation: 91356
Perhaps something like this. The idea is to save the report as HTML or RTF, then read it in:
Const ForReading = 1
DoCmd.OutputTo acOutputReport, "Report1", acFormatHTML, "Report1.htm"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("Report1.htm", ForReading)
sBody = f.ReadAll
f.Close
obj.HTMLBody = sBody
Upvotes: 2