If you are using outlook you can loop through a record set and build
and HTML email with tables. This example is an excerpt from something
I currently use but it gives you the general idea:
Set appOutlook = CreateObject("outlook.application")
Set itmOutlook = appOutlook.CreateItem(olMailItem)
itmOutlook.Recipients.Add ("email address")
itmOutlook.Subject = "subject text"
strBody = "<table border=1>"
strBody = strBody & "<tr>"
For I = 1 To 4
strBody = strBody & "<td>" & "stuff" & "</td>"
Next I
strBody = strBody & "<td>" & "more stuff" & "</td>"
strBody = strBody & "</tr>"
Do Until rst1.EOF
strBody = strBody & "<tr>"
For I = 1 To 4
strBody = strBody & "<td>" & rst1.Fields(I).Value & "</td>"
Next I
Set rst2 = db.OpenRecordset("SELECT [NAME] " _
& "FROM tbllocal " _
& "WHERE [Number]=" &
rst1.Fields(0).Value & ";", dbOpenForwardOnly)
strBody = strBody & "<td>"
strBody = strBody & "<ul>"
Do Until rst2.EOF
strBody = strBody & "<li>" & rst2.Fields(0).Value & "</li>"
rst2.MoveNext
Loop
rst2.Close
strBody = strBody & "</ul>"
strBody = strBody & "</td>"
strBody = strBody & "</tr>"
rst1.MoveNext
Loop
rst1.Close
Set rst1 = Nothing
Set rst2 = Nothing
Set db = Nothing
strBody = strBody & "</table>"
itmOutlook.htmlbody = strBody
itmOutlook.Display
Set itmOutlook = Nothing
Set appOutlook = Nothing
Tee GEE wrote:
Apparently Micrsoft didn't include this feature in Access 2003!
I would like to send a report that is all text. Access only gives the
option to send it as an attachment. I would like the report text to be
in the BODY of the email.
I created a generic button action, but it generates an attachment, and
doesn't automate the TO:, and SUBJECT: lines. Any help would be
appreciated. I have tried some of the examples in this newgroup but none
seem to work.
--------------------------------------------------
Private Sub SndPrtAssn_Click()
On Error GoTo Err_SndPrtAssn_Click
Dim stDocName As String
stDocName = "Port Assignments"
DoCmd.SendObject acReport, stDocName
Exit_SndPrtAssn_Click:
Exit Sub
Err_SndPrtAssn_Click:
MsgBox Err.Description
Resume Exit_SndPrtAssn_Click
End Sub
--------------------------------------------------
Thanks,
Tom
Forgive me...I'm a beginner programmer with expert expectations.
*** Sent via Developersdex http://www.developersdex.com ***