B
bobdydd
Hullo Everybody
I am trying to send a email from WITHIN Access 2000 with a report
attached that is generated WITHIN Access in the normal way, but all the
help examples I have seen uses an external file like C:\test.txt
I have been using:
DoCmd.SendObject acReport, stDocName, acFormatRTF,
But when the message body is more than 70 characters long (random), it
craps out, and it seems that the general opinion is that SendObject is
too unreliable to use for a runtime application.
So I have now moved to the method below which almost works except for 2
things. .........What I need to know is how to:
1.Add an attachment of one of the internal reports (rptOrderEmail) to
the email.
2. Supress the handling form with the message "Another program is
trying to access your Inbox" a pain.
Thanks in Advance
Bob
Private Sub CmdEmail_Click()
On Error GoTo Error_Handler
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Dim strDocName As String
Dim rptInvoiceEmail As Report_rptOrderEmail
strDocName = "rptOrderEmail"
Dim objOutlookAttach As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = Me.txtSupplierPrimaryEmail
.Subject = Me.txtSubject
.Body = Me.MemoSupplierNotes
Set objOutlookAttach = .Attachments.Add(strDocName)
.Send
'.ReadReceiptRequested
End With
Exit_Here:
Set objOutlook = Nothing
Exit Sub
Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here
End Sub
I am trying to send a email from WITHIN Access 2000 with a report
attached that is generated WITHIN Access in the normal way, but all the
help examples I have seen uses an external file like C:\test.txt
I have been using:
DoCmd.SendObject acReport, stDocName, acFormatRTF,
But when the message body is more than 70 characters long (random), it
craps out, and it seems that the general opinion is that SendObject is
too unreliable to use for a runtime application.
So I have now moved to the method below which almost works except for 2
things. .........What I need to know is how to:
1.Add an attachment of one of the internal reports (rptOrderEmail) to
the email.
2. Supress the handling form with the message "Another program is
trying to access your Inbox" a pain.
Thanks in Advance
Bob
Private Sub CmdEmail_Click()
On Error GoTo Error_Handler
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Dim strDocName As String
Dim rptInvoiceEmail As Report_rptOrderEmail
strDocName = "rptOrderEmail"
Dim objOutlookAttach As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = Me.txtSupplierPrimaryEmail
.Subject = Me.txtSubject
.Body = Me.MemoSupplierNotes
Set objOutlookAttach = .Attachments.Add(strDocName)
.Send
'.ReadReceiptRequested
End With
Exit_Here:
Set objOutlook = Nothing
Exit Sub
Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here
End Sub