Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Email using SendObect (2000 (SR1))

    Using SendObject to generate an email, does anyone know if it is possible to include a report or query as the content of the email message?

    Here is what I have thus far ...

    Dim strTo, strLink, strEndDate, strMsg1 As String
    strEndDate = Me.EndDate
    strTo = "Firstname.Lastname"
    strCC = "Firstname.Lastname"
    strMsg1 = "This is the message but I want to include the results of a query or report. Is it possible?"

    If IsNull(strEndDate) Or strEndDate = "" Then
    MsgBox "You must select a reporting period (Step 1)"
    Else
    DoCmd.SendObject acSendNoObject , "", acFormatHTML, strTo, strCC, "", "ALPC Employee Update - Period Ending " & strEndDate, strMsg1
    End If

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Email using SendObect (2000 (SR1))

    SendObject can only send a report as an attachment, not as the body of the e-mail message. I think it would be a lot of work to include a report as the body of the message (it would involve automating Outlook from Access; for other e-mail clients I don't know)

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Email using SendObect (2000 (SR1))

    I agree with Hans that it would take a bit of work, but I imagine you could write code that would :

    Output the report to a file in html format: Docmd.outputTo, acReport, strReportName,acFormathtml, strfilename

    Then read that file in line by line into a string variable, and include that string variable as the body of a message.
    Regards
    John



  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Email using SendObect (2000 (SR1))

    Just for the record:

    That would still require Automation, for you can't do this using SendObject. Setting the MessageText argument of DoCmd.SendObject to HTML code will cause the code to be displayed in the body of the e-mail. You need to set the HTMLBody property of the Outlook.MailItem object.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •