Question

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?

Était-ce utile?

La solution

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
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top