Domanda

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?

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top