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

Add ole object from a form as an e-mail attachment

Status
Not open for further replies.

alanach

Technical User
Sep 23, 2002
12
GB
Can someone help me??

My database automatically sends an e-mail containing all the information that is entered on a new record. However, there is an ole object on the form that I want included in the mail as an attachment. I cannot work out how to do this.

 
What method are you using to send the email, and what is your email application?

Also, what kind of OLE object is in the record? God Bless,
Mike

Yes, I believe in Jesus. ;-)
"Neither is there salvation in any other: for there is none other name under heaven given among men, whereby we must be saved." (Acts 4:12, KJV)
 
Hi,

I'm using Microsoft Outlook. See below for an example of code:

Dim objOutlook As New Outlook.Application
Dim objMail As MailItem
Set objMail = objOutlook.CreateItem(olMailItem)
With objMail
If Text83 = "No" And Text194 = "1" And Text221 = "1" And Defect_Type = "Improvement" Then
If Text190 = True Then
.Recipients.Add Text192
End If
If Text227 = True Then
.Recipients.Add Text229
End If
.FlagDueBy = Text77
.Importance = olImportanceHigh
.Subject = "Opportunity for Improvement OFI" & Hazard_ID & " has been raised"
.Body = "The following OFI has been raised:" & Chr(13) & Chr(13) _
& "OFI Number: OFI" & Hazard_ID & Chr(13) _
& "Raised By: " & Text223 & " " & Text225 & Chr(13) & Chr(13) _
& "Defect/Improvement? " & Defect_Type & Chr(13) _
& "Severity: " & Severity & Chr(13) & Chr(13) _
& "Details: " & Chr(13) & Any_other_details & Chr(13) & Chr(13) _
& "Fault Type: " & Text259 & Chr(13) & Chr(13) _
& "Responsible for 24hr Fix: " & Text185 & " " & Text188 & Chr(13) _
& "Target 24hr Fix Date: " & Text77 & Chr(13) & Chr(13) _
& "No Preventive Action is required for this OFI" & Chr(13) & Chr(13) _
& "PLEASE RESPOND TO THIS OFI ON OR BEFORE THE TARGET DATE" & Chr(13) & Chr(13) & Chr(13) _
& "This mail was sent by the Howden QA System. Please reply to the sender for more information"
.Send
 
What kind of OLE object are you using? And what purpose does it have in the email? God Bless,
Mike

Yes, I believe in Jesus. ;-)
"Neither is there salvation in any other: for there is none other name under heaven given among men, whereby we must be saved." (Acts 4:12, KJV)
 
The database is used for corrective action tracking. The OLE object is used for further information such as photo's, Excel spreadsheets, Word docs etc.

I want to add this additional information as an attachment to the e-mail that is sent.

Any help is appreciated.
 
I would export the the OLE object from the table into a temporary destination file on a available drive. Then, use .Attachments.Add to add the file to the email. After the email was sent, I would then Kill the file. God Bless,
Mike

Yes, I believe in Jesus. ;-)
"Neither is there salvation in any other: for there is none other name under heaven given among men, whereby we must be saved." (Acts 4:12, KJV)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top