PDA

View Full Version : Lotus Notes and Access



GoKats78
01-06-2009, 10:25 AM
I am trying to automatically email from a database - but we use Lotus Notes as an email client...they don't seemt o play together well...

Any thoughts on how to get Access to use LN rather than looking for an MS product to email a report would be greatly appreciated!

CreganTur
01-06-2009, 10:57 AM
If Lotus Notes is set as your computer's default e-mail application, then you can use the MailTo method. This creates an e-mail by launching the default e-mail app. I can't test it against Lotus Notes, but it should work.

This is some pretty advanced code- it makes use of the WIN API ShellExecute() method.

to send the emial you need to call the SendEmail sub and provide values for the parameters. Here's an example of how to call the sub:

SendEmail "you@hotmail.com", "This is the subject line", "This is the e-mail body."

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Const SW_SHOW As Long = 5

Sub SendEmail(strTo As String, strSubject As String, strBody As String)
Dim rc As Long
Dim strFile As String
'build the lpFile argument
strFile = "Mailto:" & strTo
strFile = strFile & "?subject=" & strSubject
strFile = strFile & "&body=" & strBody
rc = ShellExecute(0, "open", strFile, "", "", SW_SHOW)
End Sub

There are probably other ways to accomplish this that I am not aware of.

HTH:thumb