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

VB SendObject in MS Access and Lotus Notes

Status
Not open for further replies.

salrodz

Technical User
Mar 25, 2003
3
US
I posted this yesterday in a different forum, but thought someone here might have the solution. Sorry for the repeat if you've seen it before. Thanks!

I'm working with MS Access 2000 (SR-1) and using Lotus Notes 5.0.9a as my default email program. I'm having a problem using the "DoCmd.SendObject" method to generate an email with a report attached in *.rtf format. When I choose *.rtf as the output format the email is generated and the report attached, but the report format is changed to *.xls. The result is not identical to that achieved when the output format is *.xls. Further, it works fine with different formats (*.html, *.txt, and *.xls).
The code I'm using is:
DoCmd.SendObject acSendReport, stDocName, acFormatRTF, ContactName, , "myaccount@myaddress.com", "Message Subject", "Please review the attached information.", True
 
I am having almost the same problem but I would also like to set up attachments to send along with the email in lotus notes which are not the same files as what is generated in Access.
 
Perhaps you can do it the other way round? Create a Notes mail message using vba and attach the report and send it? If I have not helped, sorry, I'm a Notes person not a VB or access person.

Add into your project references the file c:\lotus\notes\domobj.tlb where c:\lotus\notes is your lotus notes program directory and use this code:

Option Explicit
Private Sub CommandButton1_Click()

Dim attachment as Object
Dim body As NotesRichTextItem
Dim dataDir As NotesDbDirectory
Dim mailbox As NotesDatabase
Dim memo As NotesDocument
Dim style As NotesRichTextStyle

Dim session As New NotesSession
Call session.Initialize("") 'Prompt for password for current id

Set dataDir = session.GetDbDirectory("")
Set mailbox = dataDir.OpenMailDatabase
Set memo = mailbox.CreateDocument()
Set body = memo.CreateRichTextItem("Body")
Set attachment = body.EmbedObject(EMBED_ATTACHMENT , "" , "c:\report.rtf")

Call memo.ReplaceItemValue("Form", "Memo")
Call memo.ReplaceItemValue("SendTo", "User Name/orgunit/org")
Call memo.ReplaceItemValue("Subject", "Here is the daily report")
Call memo.Send(False)

End Sub


Find me @ onlinecorporatesoftware.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top