View Full Version : Report in Email Body


hootie318
03-02-2006, 09:48 AM
I have to put a simple report in the body of an email. I am running limited resources and am looking for a basic code to do so.

Private Sub Command28_Click()
On Error GoTo ErrorHandler

Dim strToWhom As String
Dim strSubject As String
Dim strMsgBody As String

strSubject = "Fax Delv and Driver Count for"
strToWhom = "me@anyplace.net"
strMsgBody =

DoCmd.SendObject , faxreportqueryreport, , strToWhom, , , strSubject, strMsgBody, True

Exit Sub
ErrorHandler:
Select Case Err.Number
Case 2501
Resume Next
Case Else
MsgBox "Err " & Err.Number & ": " & Err.Description
End Select

End Sub

I cant figure out what to put for strMsgBody =
The report name doesnt work

Ethereal
03-02-2006, 01:37 PM
If you want to do anything complex with the body i suggest you work with an outlook object and use HTML body, you will need to check off the outlook object in referances. www.outlookcode.com, there are some samples there that might aid you, Other than that you have to write out the body yourself with the send object method. Also if you want to you might consider just attaching the report to the email and putting some standard text as the body such as "this is an email with the report attached"