469,288 Members | 2,353 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,288 developers. It's quick & easy.

Email Multiple Reports on one Email

is this possable to send more than 1 report in one email
Nov 13 '05 #1
7 11948
Mega1 wrote:
is this possable to send more than 1 report in one email

Send each report as a separate attachment. Save the report as Snapshot
files (or something else) and then run the email & just attach the saved
files.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
Nov 13 '05 #2
i want to automate this so when people click on it the email just sends
"MGFoster" <me@privacy.com> wrote in message
news:T8*****************@newsread1.news.pas.earthl ink.net...
Mega1 wrote:
is this possable to send more than 1 report in one email

Send each report as a separate attachment. Save the report as Snapshot
files (or something else) and then run the email & just attach the saved
files.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

Nov 13 '05 #3
If you're interested I will create a sample database (A2003) which should
meet your needs; let me know.you can email me directly.

Cheers,

Dave
"Mega1" <me***@oceanfree.net> wrote in message
news:fB*******************@news.indigo.ie...
i want to automate this so when people click on it the email just sends
"MGFoster" <me@privacy.com> wrote in message
news:T8*****************@newsread1.news.pas.earthl ink.net...
Mega1 wrote:
> is this possable to send more than 1 report in one email
>
>

Send each report as a separate attachment. Save the report as Snapshot
files (or something else) and then run the email & just attach the saved
files.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)


Nov 13 '05 #4
Hi there,

All that you need is just creating an Outlook item and
add some code there to trigger it.

Also Microsoft Outlook 9.0 Object Library must be checked in
Tool/References area.

I added a short sample below.

I hope you'll find your answers there.

Take care.

Murat.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Sub SendMessage()
Dim OL As Outlook.Application, OI As Outlook.MailItem, OA As Outlook.Attachments
Set OL = Outlook.Application
Set OI = OL.CreateItem(olMailItem)
OI.Recipients.Add "ms*****@ford.com.tr"
OI.CC = "an****@ford.com.tr"
OI.BCC = "so*****@ford.com.tr"
OI.Subject = "Sample"
OI.Body = "Hi there"
Set OA = OI.Attachments
OA.Add "L:\FMS\REPORTS\Lease.xls", olByValue, 1, "Leasing Report"
OA.Add "L:\FMS\REPORTS\Action.xls", olByValue, 1, "Action Report"
OA.Add "L:\FMS\REPORTS\Finance.xls", olByValue, 1, "Finance Report"
OI.Send
End Sub
Nov 13 '05 #5
This is the code i was using
Dim MyDB As Database
Dim MyRS As dao.Recordset
Dim TheAddress As String
Dim stDocName As String
Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("qryEmailFlyer")
MyRS.MoveFirst
Do Until MyRS.EOF
TheAddress = MyRS![EmailAddress]

stDocName = "Movie Program"
DoCmd.SendObject acReport, stDocName, acFormatSNP, TheAddress, , ,
"movie program Starting " & Text2, "If you cannot view please download the
viewer at
http://www.microsoft.com/downloads/details.aspx?FamilyID=b73df33f-6d74-423d-8274-8b7e6313edfb&DisplayLang=en",
False
DoCmd.SendObject acReport, "Synopsis", acFormatSNP, TheAddress, , ,
"Synopsis", , False

MyRS.MoveNext
Loop
"Fahrettin Murat Selcuk" <ms*****@ford.com.tr> wrote in message
news:7d**************************@posting.google.c om...
Hi there,

All that you need is just creating an Outlook item and
add some code there to trigger it.

Also Microsoft Outlook 9.0 Object Library must be checked in
Tool/References area.

I added a short sample below.

I hope you'll find your answers there.

Take care.

Murat.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sub SendMessage()
Dim OL As Outlook.Application, OI As Outlook.MailItem, OA As Outlook.Attachments Set OL = Outlook.Application
Set OI = OL.CreateItem(olMailItem)
OI.Recipients.Add "ms*****@ford.com.tr"
OI.CC = "an****@ford.com.tr"
OI.BCC = "so*****@ford.com.tr"
OI.Subject = "Sample"
OI.Body = "Hi there"
Set OA = OI.Attachments
OA.Add "L:\FMS\REPORTS\Lease.xls", olByValue, 1, "Leasing Report"
OA.Add "L:\FMS\REPORTS\Action.xls", olByValue, 1, "Action Report"
OA.Add "L:\FMS\REPORTS\Finance.xls", olByValue, 1, "Finance Report"
OI.Send
End Sub

Nov 13 '05 #6
I read your message to quickly; my example provides the option to send one
report to multiple email addresses. Regardless, it may prove of value, and
can easily be modified: the zipped example is only 96kb.

Cheers,

Dave
Nov 13 '05 #7
Code used for Button to send email:

'================================================= ====
Private Sub cmdSendRpt_Click()

' Attach Access Snapshot Report to Email & Send

Dim strTO As String
Dim strCc As String
Dim cnt As Long

If Me.lstEMailAddresses.ItemsSelected.Count = 0 Then
MsgBox "No email addresses have been selected; please select one or
more " _
& "email addresses, and then try again."
Else

For cnt = 0 To Me.lstEMailAddresses.ItemsSelected.Count - 1
strTO = strTO & ";" & Me.lstEMailAddresses.Column(0, _
Me.lstEMailAddresses.ItemsSelected(cnt))

Next cnt

strTO = Mid(strTO, 2)
' Send Report using MS Access Snapshot
DoCmd.SendObject acReport, "rptPersEMail", "SnapshotFormat(*.snp)", _
strTO, strCc, "", "Place Your Email Subject Heading Here", "From the
Office " _
& "of... Your Name Here - Report Name Here (Optional)." & vbCrLf &
vbCrLf _
& "Please see attached MS Access Snapshot Report" & vbCrLf & vbCrLf &
vbCrLf & vbCrLf & "----------------------------" _
& vbCrLf & vbCrLf & "Microsoft Snapshot Viewer Required to view
attachment: Download Snapshot " _
& "Viewer from the Microsoft Site: " _
&
"http://www.microsoft.com/downloads/details.aspx?familyid=B73DF33F-6D74-423D-8274-8B7E6313EDFB&displaylang=en"
_
& vbCrLf & vbCrLf & "The Snapshot Viewer enables you to view a report
snapshot without having the standard or run-time versions of Microsoft
Access.", True

End If
End Sub

'================================================= ====

and

Create a new module:

'================================================= ====

Option Compare Database 'Use database order for string comparisons
Option Explicit 'Require variables to be declared before being
used

'************ Code Start **********
'This code was originally written by Dev Ashish.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code Courtesy of
'Dev Ashish

Private Declare Function apiShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long

'***App Window Constants***
Public Const WIN_NORMAL = 1 'Open Normal
Public Const WIN_MAX = 2 'Open Maximized
Public Const WIN_MIN = 3 'Open Minimized

'***Error Codes***
Private Const ERROR_SUCCESS = 32&
Private Const ERROR_NO_ASSOC = 31&
Private Const ERROR_OUT_OF_MEM = 0&
Private Const ERROR_FILE_NOT_FOUND = 2&
Private Const ERROR_PATH_NOT_FOUND = 3&
Private Const ERROR_BAD_FORMAT = 11&

'***************Usage Examples***********************
'Open a folder: ?fHandleFile("C:\TEMP\",WIN_NORMAL)
'Call Email app: ?fHandleFile("mailto:da****@hotmail.com",WIN_NORMA L)
'Open URL: ?fHandleFile("http://home.att.net/~dashish",
WIN_NORMAL)
'Handle Unknown extensions (call Open With Dialog):
' ?fHandleFile("C:\TEMP\TestThis",Win_Normal)
'Start Access instance:
' ?fHandleFile("I:\mdbs\CodeNStuff.mdb", Win_NORMAL)
'************************************************* ***

Function fHandleFile(stFile As String, lShowHow As Long)

Dim lRet As Long
Dim varTaskID As Variant
Dim stRet As String

'First try ShellExecute
lRet = apiShellExecute(hWndAccessApp, vbNullString, _
stFile, vbNullString, vbNullString, lShowHow)

If lRet > ERROR_SUCCESS Then
stRet = vbNullString
lRet = -1
Else

Select Case lRet
Case ERROR_NO_ASSOC:
'Try the OpenWith dialog
varTaskID = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " _
& stFile, WIN_NORMAL)
lRet = (varTaskID <> 0)
Case ERROR_OUT_OF_MEM:
stRet = "Error: Out of Memory/Resources. Couldn't Execute!"
Case ERROR_FILE_NOT_FOUND:
stRet = "Error: File not found. Couldn't Execute!"
Case ERROR_PATH_NOT_FOUND:
stRet = "Error: Path not found. Couldn't Execute!"
Case ERROR_BAD_FORMAT:
stRet = "Error: Bad File Format. Couldn't Execute!"
Case Else:
End Select

End If

fHandleFile = lRet & _
IIf(stRet = "", vbNullString, ", " & stRet)

End Function
'================================================= ====
Nov 13 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Eliezer Figueroa | last post: by
2 posts views Thread by Sigurd Bruteig | last post: by
3 posts views Thread by ian_jacobsen | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.