Email Report use outlook

PShiers

Registered User.
Local time
Today, 20:02
Joined
May 2, 2009
Messages
26
I have a very established DB and want to add the functionality that allows the user to email a report instead of print or preview.

Have try sendobject, it works by get security 'Alloy', 'Deny'

Has search the internet a lot and see the outlook can be called direct and sent this way. However, when it come to attachment all the example seem to be attaching external files (e.g. .xls or .doc).

How do I connect to outlook and send a MS access report as the attachment.

Thanks in advance for any help

:confused:
 
If you want to use send object and get the warnings, you need a third party download to have it retain the yes. There is a website that provides this as free download called Click Yes/No. Here is the link

http://www.contextmagic.com/express-clickyes/

One point though is that if you are sending a report then the receipient must have the Access Report Viewer (Snapshot) installed on there machines.
 
Thanks for the reply

I actually don't want to use sendobject unless it is the only way to send a MS Access Report by email.

MS Support suggest the following code http://support.microsoft.com/?kbid=209948

...
Sub SendMessage(Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("Nancy Davolio")
objOutlookRecip.Type = olTo

' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("Andrew Fuller")
objOutlookRecip.Type = olCC

' Set the Subject, Body, and Importance of the message.
.Subject = "This is an Automation test with Microsoft Outlook"
.Body = "Last test - I promise." & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance

' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send

End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub
...

But I can't see how I would automatically attach a MS Access Report

Many Thanks in Advance
 
But I can't see how I would automatically attach a MS Access Report


You will need to write some code to save your MS Access report locally on your machine, and use the same URL you have used to save the MS Access report locally to capture the report with the code you have shown in outlook.
 
its this bit you used

' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

but your prog probably needs to generate a pdf (instead of a snapshot) in order to then attach it - which is either A2007 up, or maybe use an external method - (I use Stephen Lebans method)
 

Users who are viewing this thread

Back
Top Bottom