Results 1 to 6 of 6
  1. #1
    stu_C is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    38

    Email Report in Body

    Hi all
    try and explain, I have a Access report with details that I want to be emailed off to certain people, the access report details must be in the body of the Email and not a attachment and in specific layout any suggestions on how to do this?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    you can send an email as an attachment with a single statement: Docmd.SendObject.
    To put it in the body takes a lot of vb code.
    Why cant your users double-click on the attachment? Is it too much work?

  3. #3
    stu_C is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    38
    I know how to do the attachment but unfortunately it's not allowed to be

  4. #4
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    in this case you're not dealing with a report at all. you need to make some VBA that will display the information as you want it. (you can put it in a text box for practice).

    Ill post some code shortly how to edit email content. But the formatting of the text is the bit you need to work on.

  5. #5
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Code:
    Dim oApp As Outlook.Application
    Dim oMail As MailItem
    Set oApp = CreateObject("Outlook.application")
    Set oMail = oApp.CreateItem(olMailItem)
    oMail.Body = Me!Site_Name & " " & Me!Asset_Type & vbCrLf & Me!Address_1 & vbCrLf & Me!Address_2 & vbCrLf & Me!Address_3 & vbCrLf & Me!Postcode & vbCrLf & vbCrLf & "Hospital Details:" & vbCrLf & Me!Hospital_Name & vbCrLf & Me!Hospital_Address & vbCrLf & Me!Hospital_Postcode & vbCrLf & "Tel: " & Me!Hospital_Telephone
    oMail.Subject = Me!Site_Name & " Details"
    'oMail.To = Me!text_email
    
    If IsNull(Me!text_email) = True Then
      oMail.To = "test"
     oMail.Display
     AppActivate oMail.Subject
     Else
     oMail.To = Me!text_email
      oMail.Display
      AppActivate oMail.Subject
    End If
    Set oMail = Nothing
    Set oApp = Nothing
    End Sub

    this is code I use to email site locations. it can be adapted to include whatever fields you want. any questions just ask... main point when formatting the body is "vbcrtlf" is a paragraph break and also include " " for spaces.

  6. #6
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 8 Access 2013
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    I am not were I can post any sample code at this time.

    Here are the basics of how I do it:

    1) save the report to a file as HTML

    2) load the saved report from the file into the .HTMLBody of a message.


    FMS also sells a tool called Total Access Emailer (Click Here) that does the same thing.

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

Similar Threads

  1. Sending Report In Email Body
    By cdscivic in forum Access
    Replies: 3
    Last Post: 12-07-2016, 09:47 AM
  2. Replies: 3
    Last Post: 05-18-2015, 11:24 AM
  3. Email report as body of email (RTF)
    By TheDeceived in forum Programming
    Replies: 4
    Last Post: 07-23-2012, 06:39 AM
  4. Email report as body of email
    By chrish20202 in forum Programming
    Replies: 6
    Last Post: 01-15-2012, 07:23 PM
  5. Email from report to Email body
    By Ehmke66 in forum Programming
    Replies: 4
    Last Post: 01-03-2011, 01:06 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