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

Email using Access

Status
Not open for further replies.

jdwm2310

Technical User
Jul 26, 2001
396
US
Hi,

I have a problem, I have Access 97 and I want to send a message,using Lotus Notes.

Can someone help me as to how I can do this..thanks
 
Use following structure within VB code (kind of trick):

Code:
 Application.FollowHyperlink EMailString, "0", True, False

where EMailString looks like "mailto:User Name/OU/O?Subject=An email subject"

But there are some boundaries:
* you must have Lotus Notes as default E-mail program set up in internet settings (in my case IE 6.)
* you have to manually input message body :( (standard RFC mailto option ?Body= does not work with Notes (it works with Outlook Express))
* you have to manually send message :(

Regards,
sgk
 
Hi JDWM

I found this code on the MS Access forum on tek-tips (cant remember where exactly but a search will find it):


Hope it helps!
Klopper

Public Sub EmailWithNotes(strSendTo As String, strSubject As String, Optional strCCTo As String, _
Optional strBody As String, Optional strAttachPath As String)

Dim objSession As Object
Dim objDB As Object
Dim objDoc As Object
Dim objAttach As Object
Dim objEmbed As Object
On Error GoTo err_EmailWithNotes
' -Creates a Lotus Notes Session if there isn't one already running
Set objSession = CreateObject("Notes.NotesSession")
' -Set db to a database not yet named
Set objDB = objSession.GETDATABASE("", "")
' -Sets database to default mail database
Call objDB.OPENMAIL
' -Creates a new mail document
Set objDoc = objDB.CREATEDOCUMENT
' -Insert passed variables into mail document.
Call objDoc.REPLACEITEMVALUE("SendTo", strSendTo)
Call objDoc.REPLACEITEMVALUE("Subject", strSubject)
' -Note: This code only functions for CCing or BCCing to one addresss each.
Call objDoc.REPLACEITEMVALUE("CopyTo", strCCTo)
' -Note: This code does not leave a copy of the email that
' is being created in the sent box, so to have a copy
' BCC is used to send copy to self
Call objDoc.REPLACEITEMVALUE("BlindCopyTo", objSession.UserName)
Call objDoc.REPLACEITEMVALUE("Body", strBody)
If Not strAttachPath = "" Then
Set objAttach = objDoc.CREATERICHTEXTITEM("Attachment")
' -Note: More than one attachment can be sent, but than this code
' needs to be copied elsewhere and the following line needs to
' be executed with a new attachment path for every attachment.
Set objEmbed = objAttach.EMBEDOBJECT(1454, "", strAttachPath)
End If
' -Send new mail document
Call objDoc.SEND(False)
' -Reset objects back to nothing to clear memory
exit_EmailWithNotes:
Set objDoc = Nothing
Set objDB = Nothing
Set objSession = Nothing
Set objAttach = Nothing
Set objEmbed = Nothing
Exit Sub
err_EmailWithNotes:
MsgBox Err.Description, , Err.Number
GoTo exit_EmailWithNotes
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top