Results 1 to 4 of 4
  1. #1
    msixpackabs is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    11

    Attach access reports as attachment in form looking like Outlook New Message

    Click image for larger version. 

Name:	001.png 
Views:	12 
Size:	25.6 KB 
ID:	25035
    In order to make things easier, from communication point of view, I created this "New E-mail form" in my app. It automatically generates To,Cc, Subject, Body Text depending on the day I send the e-mail in.
    When pressing Send, first it makes sure that the required fields are filled and then it sends the message using background outlook (the red label warns users that they have to make sure Outlook is opened.

    Is it possible for it to automatically attach the corresponding reports instead of asking E-mail recipients to run and have them printed?
    I mean, I wish I was able to attach reports that are created within app itself, based on the content in the E-mail Screen.

    E.G. E-mail Luni (Monday E-mail) - sends an e-mail based on hidden cbo's values. The screen "knows"exactly what reports should create but I have no idea how to attach and then have them moved as "e-mail attachments" in outlook.

    The called function on send is:

    Public Function Email1(ByVal pvTo, ByVal pvCc, ByVal pvSubj, ByVal pvBody, ByVal pvFile) As Boolean
    Dim oApp As Outlook.Application
    Dim oMail As Outlook.MailItem
    On Error GoTo ErrMail
    Set oApp = CreateObject("Outlook.Application")
    Set oMail = oApp.CreateItem(olMailItem)
    With oMail
    .TO = pvTo
    If Not IsNull(pvCc) Then .CC = pvCc
    .Subject = pvSubj
    If Not IsNull(pvBody) Then .Body = pvBody
    If Not IsEmpty(pvFile) Then .Attachments.Add pvFile, olByValue, 1
    .Send
    End With
    Email1 = True
    Set oMail = Nothing
    Set oApp = Nothing
    Exit Function
    ErrMail:
    MsgBox Err.Description, vbCritical, Err
    Resume Next


    End Function

    How do I define pvFile as two reports that auto generates as PDF?
    Last edited by msixpackabs; 06-26-2016 at 05:14 AM. Reason: typo

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You can use OutputTo to create a file, and use the path to that file to add an attachment.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    msixpackabs is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    11
    lol...easy ti say...but hard to do?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Not particularly, no. Have you tried?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 5
    Last Post: 09-05-2014, 12:06 PM
  2. Replies: 5
    Last Post: 10-08-2013, 08:16 AM
  3. Replies: 1
    Last Post: 04-01-2013, 05:00 PM
  4. Replies: 31
    Last Post: 08-15-2012, 03:33 PM
  5. Export Access reports/query results to Outlook Calendar/Task
    By kfinpgh in forum Import/Export Data
    Replies: 0
    Last Post: 02-22-2007, 01:09 PM

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