Emailing Reports

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Keriana30
    New Member
    • Nov 2007
    • 7

    Emailing Reports

    I'm using the following code in an attempt to email reports from a database form in Access.
    [Code=vb]
    With EMsg
    Set .Configuration = EConf
    .To = Recip (variable)
    .CC = "Susan.Miller@o cfl.net"
    .From = "Susan.Miller@o cfl.net"
    .Subject = "Please read: Test CDO message with Attached Reports"
    .HTMLBody = strHTML
    .addattachment (stDocName)
    .send
    End With
    [/Code]
    As long as the value of stDocName = nothing the email will work but will send a dat file (blank). If I assign a value (Report Name) to stDocName I get an error that reads Run-time Error '-2146697203 (800c000d)'; Specified protocol is unknown. Has anyone encountered this before or have any idea how to correct?

    Thank you,
    Keriana
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please use code tags.


    You can't attach the report object as an attachment. It has to be a file. So you must first export the report to a file and then attach the file.

    Comment

    • MMcCarthy
      Recognized Expert MVP
      • Aug 2006
      • 14387

      #3
      Originally posted by Rabbit
      Please use code tags.


      You can't attach the report object as an attachment. It has to be a file. So you must first export the report to a file and then attach the file.
      You can export it in snapshot form which will retain all formatting etc.

      Comment

      Working...