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?
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?
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?
I know how to do the attachment but unfortunately it's not allowed to be
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.
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.
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.