Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

E-mailing multiple reports in one e-mail 1

Status
Not open for further replies.

smicro

MIS
Dec 26, 2002
281
US
I've been searching on here for this, I apologize if it was already posted. Basically I'm trying to send one e-mail that contains multiple reports from my database. I can get it to mail one report in an e-mail with no problem but was wondering if there was a way to send one e-mail containing multiple reports. Also curious if it's possible to send one report to multiple e-mail address. Below is the "simple" code I have. Simple key word, I'm a beginner :)



Private Sub report_Click()

On Error GoTo Err_Report_Click
DoCmd.SendObject acSendReport, "property", acFormatHTML, "To", , , "Subject", "message", True
Err_Report_Click:
MsgBox "You've chosen not to send this email "

End Sub
 
Thanks ssatech, that looks good. Thanks for the help!
 
Hi Smicro,

I have a similar problem. I would like to send multible 'Reports' to one recipient. However, I don't think Arvin Meyer's solution helps. It sends one report, as HTML, to multible recipients.
Could anyone help me with a problem the other way arround?!

The problem is that the 'DoCmd.SendObject acSendReport' does not allow you to 'attach' more that one report... The recipient is also only one name 'name@compagny.com;name1@compagny1.com'.
It's just that Outlook is able to handle it as multible recipients.

Regards!
 
Fensbo,

I use outlook, and it looks like that is what you will be using too. I have a documents table (named EmailDocuments) that has a link to where the documents are located on the server, as well as a yes/no check box to determine if that document is to be attached or not. Then I run a loop to attach all documents that are checked (yes or true) to attach.

On my form, I have a subform that has all of the documents where they can be searched through and checked if the user wants them sent. Each time the form is opened it goes through and unchecks any documents that are checked so that the documents that were sent the last time are not attached again.

I am fairly new to Access programming, but here is the code I use. The code is ran by clicking a button that calls the following function. eg. Call MailParameters

'Code Start
Function MailParameters()
Dim rstT As DAO.Recordset
Dim strSQL As String
Dim strAttatch As String
Dim outApp As Outlook.Application
Dim outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

'these three lines set the recordset for the files I want attached.
strSQL = "SELECT DocumentsEmail.*, DocumentsEmail.Attach"
strSQL = strSQL & " FROM DocumentsEmail WHERE Attach= Yes"
Set rstT = CurrentDb.OpenRecordset(strSQL)

'starting the outlook message.
With outMsg
'.Importance = olImportanceHigh
.To = Contact@address.com
'.CC = "CC EMAIL ADDRESS GOES HERE"
'.BCC = "BCC EMAIL ADDRESS GOES HERE"'
'.Subject = "Proposal"
.Body = "Dear whomever”
'here is the loop that attaches the files.
If rstT.RecordCount > 0 Then
With rstT
.MoveFirst
Do While Not .EOF
strAttatch = !DocumentLink
outMsg.Attachments.Add (strAttatch)
.MoveNext
Loop
.Close
End With
End If
Set rstT = Nothing

' If you want the screen to be seen then add the following line
.Display
'.Send 'This is if you want to automatically send the message
End With
Set outApp = Nothing
Set outMsg = Nothing
End Function

'End Code

I am going to work today or tomorrow on getting it to be able to add multiple recipients as well, if this works for you and you would like the code addition when I finish it, let me know.

Good luck,

Eric
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top