Link to home
Start Free TrialLog in
Avatar of limobill
limobill

asked on

Email Multiple Query Lines in the Body of an Email with Access

I need to send query results to specific individuals (The recipients will not change).  I need to send a query and would like multiple lines to appear in the email body.  I've attach some code that works but just returns the first line of the query.  Thanks
Private Sub button_email_Click()
Dim db As Database
Dim rs As Recordset
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
Set db = CurrentDb
Set rs = CurrentDb.OpenRecordset("qryEmail_IRs")
Recipient = "jdoe@yahoo.com"
With MailOutLook
        .To = Recipient
        .Subject = "Incident Report"
        .Body = rs!TripID & " " & rs!Booker
        .DeleteAfterSubmit = True
        .Send
    End With
    Set MailOutLook = Nothing
    Set appOutLook = Nothing
    Exit Sub

End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of limobill
limobill

ASKER

That's it  - perfect and Thanks!
Worked perfectly