How can I send an email using send object containing multiple records?

How can I send an email using send object containing multiple records in MS Access?  Currnetly I can send an email using sendobject. I would like to include records from a subform how and where would I do that.
seanlhallAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
I would recommend  you using a report is you wan to use send object.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GRayLCommented:
Do you mean you want the addressee to receive only the data from the subform and not the main form?  To my knowledge that cannot be done.  Remember a subform is not really a form but rather a control and all controls on a form are included in the attachment when the form is Emailed.
seanlhallAuthor Commented:
I worded it wrong I want to include records from a related table. How do I get all related records in the email?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

GRayLCommented:
Just as you can send a Table as an attachment in half a dozen formats, including html and rtf, so can you send a query containing info from several tables - if that's what you meant by 'I want to include records from a related table.'
seanlhallAuthor Commented:
Not as an attachment but in the email body.
seanlhallAuthor Commented:
Here is what I was working on. The problem I am having is it only puts in one record I need every recrod put in the body of the email.
Private Sub EmailUpdates_Click()
Dim objOL As New Outlook.Application
Dim objOLMail As Outlook.MailItem
Dim Empname As String
Dim empemail As String
Dim db As Database
Dim rcd As Recordset
Dim SQLUpdate As String, Updatetext As String
empemail = "email here"
Set db = Currentdb()
SQLUpdate = "SELECT tblupdatetable.caseupdate FROM tblupdatetable"

Set rcd = db.OpenRecordset(SQLUpdate, dbOpenSnapshot)

With rcd
      .MoveFirst
      Do Until rcd.EOF
            Updatetext = .Fields(0)
            .MoveNext
      Loop
End With
strBody = Updatetext
    Set objOLMail = objOL.CreateItem(olMailItem)
    With objOLMail
        .To = empemail
        '.cc =
        .subject = Nz(strSubject, "")
        .Body = Nz(strBody, "")
        If Nz(strpath, "") <> "" Then
            .Attachments.Add strpath
        End If
        .display
    End With
Exit_EmailUpdates:
      Set db = Nothing
      Set rcd = Nothing
      Exit Sub
End Sub

Open in new window

seanlhallAuthor Commented:
I fiqured it out.
Private Sub EmailUpdates_Click()
Dim objOL As New Outlook.Application
Dim objOLMail As Outlook.MailItem
Dim Empname As String
Dim empemail As String
Dim db As Database
Dim rcd As Recordset
Dim SQLUpdate As String, Updatetext As String
empemail = "email here"
Set db = Currentdb()
SQLUpdate = "SELECT tblupdatetable.date, tblupdatetable.caseupdate FROM tblupdatetable"

Set rcd = db.OpenRecordset(SQLUpdate, dbOpenSnapshot)

With rcd
      .MoveFirst
      Do Until rcd.EOF
            strBody = strBody & .Fields(0) & vbCrLf & .Fields(1) & vbCrLf & vbCrLf & "Update" & vbCrLf
            .MoveNext
      Loop
End With
    Set objOLMail = objOL.CreateItem(olMailItem)
    With objOLMail
        .To = empemail
        '.cc =
        .subject = Nz(strSubject, "")
        .Body = Nz(strBody, "")
        If Nz(strpath, "") <> "" Then
            .Attachments.Add strpath
        End If
        .display
    End With
Exit_EmailUpdates:
      Set db = Nothing
      Set rcd = Nothing
      Exit Sub
End Sub

Open in new window

GRayLCommented:
Wouldn't it make more sense to replace the first vbCrLf with ", " and remove the trailing "Update" & vbCrLf.  That way you will have the two fields from each record on the same line.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.