• Email using SendObect (2000 (SR1))

    • This topic has 6 replies, 3 voices, and was last updated 21 years ago.
    Author
    Topic
    #402990

    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

    Viewing 3 reply threads
    Author
    Replies
    • #806537

      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)

    • #806538

      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)

    • #806587

      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.

      • #806595

        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.

      • #806596

        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.

    • #806588

      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.

    Viewing 3 reply threads
    Reply To: Email using SendObect (2000 (SR1))

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: