Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004

    Unanswered: Emailing Reports

    I am trying to send a Report by way of my outlook email. I have investigated the Docmd.SendObject method of doing so but have met with some problems. I am not able to filter the report to pull up just the record I am wanting, and also when and if I don't actually send the email from outlook it gives me an error canceled procedure in Access. Any suggestions would be greatly appreciated.

    Adam Kracht

  2. #2
    Join Date
    Jan 2004
    i use excel and adobe to create reports...

    as for sending the reports i use the folllowing code:

    Sub Send_Report()
    Dim oMailApp As Outlook.Application
    Dim oMail As Outlook.MailItem
    Mpath = "c:\file.xls"
        Set oMailApp = CreateObject("Outlook.Application")
        Set oMail = oMailApp.CreateItem(olMailItem)
        With oMail
            .To = "John Doe"
            .CC = "Jane Doe"
            .Subject = "Report""
            .Body = vbCrLf & vbCrLf & "Please print the letters and mail." & vbCrLf & vbCrLf & "Thanks." & vbCrLf & vbCrLf
            .Attachments.Add Mpath
        End With
    End Sub

  3. #3
    Join Date
    Nov 2003
    The SendObject method does exactly as it states....sends an Object. All be it a report containing one record or, a report containg a dozen records. It is the report that is the object and therefore you will need to Query for just the record or records to place into the report you wish to send.

    To prevent the canceled send mail message, try

    DoCmd.SetWarnings False
    DoCmd.SendObject acSendReport, blah, blah, blah, etc.

    but don't foreget to:

    DoCmd.SetWarnings True

    when you close your report form.

    If you want to confirm the name of the current application Object with focus try:

    MsgBox Application.CurrentObjectName

    __________________________________________________ __

    If you decide you want to use michelin man's method, which works just fine as well, then you will need to save your report to disk (preferably in RTF format since that seems to mail the best). To do this you can use the DoCmd.OutputTo method. For example:

    Dim Strg As Variant
    Strg = Application.CurrentObjectName
    DoCmd.OutputTo acOutputReport, Strg, acFormatRTF, _
    "C:\My Documents\" & Strg & ".rtf" the way....if you want to send your report to more than one recipient then pile your e-mail addresses together seperated by a semicolon, i.e.:;;;

    Hope this has helped a little.

Posting Permissions

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