Results 1 to 5 of 5
  1. #1
    ssworthi is offline Novice
    Windows 8 Access 2013
    Join Date
    May 2015
    Posts
    22

    Angry Emailing Reports

    I have tried to send reports out of Access with the email button Access offers and every time I try it opens a dialog of setting up an Outlook email account. I already have an account in Outlook but I go through the set up account steps anyway and then it says it doesn't recognize my account. What the what? I scream to myself; can someone help me figure this out. I am stumped. Thank you so much; so frustrating.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You have Outlook installed and set up on your computer? Is it open and you are logged in?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    InsuranceGuy is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Colorado
    Posts
    126
    I'm a big fan of CDO for these reasons.

    Simple example: http://www.rondebruin.nl/win/s1/cdo.htm
    Complex example: http://www.cpearson.com/excel/Email.aspx

    I've found the complex example to be fickle. Attachments get corrupted during the transmit process if you omit some of the string values which are defined optional in Chip's code sample. Pass a single space (" ") to subject, body and html body values instead of leaving blank to avoid the issues.

    Best of luck,

    Jeff

  4. #4
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    Here's is a portion of code I have in my template DB.

    Code:
    Public Sub Masteremail()
        Dim objOutlook As Outlook.Application
        Dim objOutlookMsg As Outlook.MailItem
        Dim objOoutlookRecip As Outlook.Recipient
        Dim objOutlookAttach As Outlook.Attachment
        Dim sfile As String
        Dim filetocopy As String
        Dim fs As Object
        Set fs = CreateObject("scripting.filesystemobject")
        Set objOutlook = CreateObject("Outlook.Application")
        Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
        'Add list of recipients here
        objOutlookMsg.Recipients.Add ("@")
        With objOutlookMsg
            .Subject = "EMail subject Here"
            .Body = "EMail Body Here"
        End With
        sfile = "Enter the filename here"
        objOutlookMsg.Attachments.Add (sfile)
        'Repeat the above 2 lines for each file to add
        'Send the email
        objOutlookMsg.Send
        'Clear out the objects
        Set objOutlookMsg = Nothing
        Set objOutlook = Nothing
    
    
    End Sub
    Works pretty well for me

  5. #5
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    Forgot to mention I export the report/query to a file usually PDF and there are 2 lines I modify depending on what I'm sending out and to whom.

    Both follow comments in the previous post that tell you what needs to be put in there.

    Also if you have multiple reports that could go to multiple recipients you could add 2 parameters one for the filename and 1 for the recipients and replace those 2 lines with the parameters. You could also modify if sending out multiple files to the same recipient but I haven't had to do that as yet.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Emailing a PDF
    By Gina Maylone in forum Access
    Replies: 4
    Last Post: 04-13-2015, 11:37 AM
  2. Emailing Muliple Reports
    By GWILKIE in forum Access
    Replies: 4
    Last Post: 10-25-2013, 02:46 PM
  3. Emailing reports from access
    By doopml in forum Programming
    Replies: 3
    Last Post: 10-24-2012, 11:18 AM
  4. Replies: 2
    Last Post: 05-20-2011, 10:18 AM
  5. Emailing forms or reports
    By dcecil in forum Reports
    Replies: 6
    Last Post: 12-16-2009, 07:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums