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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 97 sendig more than one report via SendObject

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
US
Hi all


I need to send more than one report in an e-mail, as im aware teh send object commmand only supports sending one object

apart from writing a ton of code that creates a temp file and then uses the outlook model to attach the attachments is there any other way of doing this ?

could i create my own object type somehow ? or coudl i do something with the Tag property of one of the objects to sneaky beaky attach a second item ?


Chance



 
gave up in the end and went with the outlook object,

anyone who comes across this problem here is the code i used

Function GetEmailReport()
Call emailReport
End Function

Sub emailReport()
On Error Resume Next

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookAttach As Outlook.Attachment


'---------------------------------------exportdataToTemp---------------------------------------
DoCmd.SetWarnings False
DoCmd.OutputTo acReport, "repcustombystatusreport", "RichTextFormat(*.rtf)", "c:\temp\RichRep.rtf", False, ""
DoCmd.OutputTo acReport, "repcustombystatusreport", "MicrosoftExcel(*.xls)", "c:\temp\ExcRep.xls", False, ""
'---------------------------------------------------------------------------------------------
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
.Attachments.Add "C:\temp\richrep.rtf", olByValue, 1, "Rich Text Report"
.Attachments.Add "C:\temp\Excrep.xls", olByValue, 2, "Excel Spreadsheet"
.Display

End With

Set objOutlook = Nothing
Set objOutlookMsg = Nothing


End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top