In Access, there are two ways you can output a separate HTML file for each record:[ul]
[li]Create a report that displays one record per page, and then output the report as an HTML file.[/li]
[li]Use the PRINT statement in VBA to enumerate through a recordset, format each field as HTML tags, and then output each record to an HTML file.[/li]
[ul]
[li]How do I use *PRINT statement in VBA?[/li]
[li]How can I format(Font/Bold/Underline/Spacing) in VBA and pass it to the body of an Email?[/li][/ul][/ul]
I am trying to use data (from a MS Access Form and VBA(SQL) to build and load the body of an Email with a formatted report. But my various attempts have not worked
*Tried:*
*Tried:*
Appreciative for any help/advice,
Alan
[li]Create a report that displays one record per page, and then output the report as an HTML file.[/li]
[li]Use the PRINT statement in VBA to enumerate through a recordset, format each field as HTML tags, and then output each record to an HTML file.[/li]
[ul]
[li]How do I use *PRINT statement in VBA?[/li]
[li]How can I format(Font/Bold/Underline/Spacing) in VBA and pass it to the body of an Email?[/li][/ul][/ul]
I am trying to use data (from a MS Access Form and VBA(SQL) to build and load the body of an Email with a formatted report. But my various attempts have not worked
*Tried:*
Code:
DoCmd.SendObject OutputFormat:=acFormatHTML, to:=ToEmailsListTxt, Subject:=SubjectLineTxt, MessageText:=BodyOfEmailTxt, EditMessage:=EditMessageTxt
[COLOR=red]'Resulting in no formatting, left justified ugly report[/color]
*Tried:*
Code:
[COLOR=red]'~Create temp HTML work area --[/color]
TempHtmlWorkArea = Environ("Temp") & "\InvoiceRptTemp.txt"
If Len(Dir(TempHtmlWorkArea)) > 0 Then
Kill TempHtmlWorkArea
End If
DoCmd.OutputTo acOutputReport, strReportName, acFormatHTML, TempHtmlWorkArea
intFile = FreeFile
[COLOR=red]'Open TempHtmlWorkArea For Input As #intFile[/color]
Open TempHtmlWorkArea For Input As #intFile
[COLOR=red]'Load temp HTML work area --[/color]
Do While Not EOF(intFile)
Line Input #intFile, strLine
BodyOfEmailTxt = BodyOfEmailTxt & strLine
Loop
Close #intFile
DoCmd.SendObject acSendNoObject, "", acFormatHTML, strTo, , , strSubject, BodyOfEmailTxt
[COLOR=red]'Resulting in formatted but only first page of report.[/color]
Appreciative for any help/advice,
Alan