Is there a way to Call a Lotus Notes agent from Access code and pass Variables?

5 pts.
Lotus Notes
Microsoft Access
Microsoft Windows XP
I'm on a Windows XP Pro System using M.S. Access 2003 and Lotus Notes 6.5. I provide adhoc and ancillary reports to our user community. We now have to send a hotspot to the users to inform them where their Excel files can be found. I created an agent that will send an email to a specific user, and display on the screen the path and file name as a link. This works great. I called the AGENT: MY_HOTSPOT_AGENT Now I need to find a way to Call an agent from Access code and also be able to pass as variables the StrRecipients, StrSubject and StrHTML strings. See code below. This way I can programmatically send to any recipient, alter the subject accordingly and modify the StrHTML sting to send the file that the recipient is expecting to recive. Can an AGENT be envoked from Access? Can variables be passed from Access? Do I need to make any modifications to the properties of the agent? Can you provide an example of the Access code that I will need?. Please view below my AGENT code. Thanks in advance for your help. Option Public ------------- Declarations ------------ Const TYPE_HTML = 21 Const ITEM_SIGN = &H0001 Declare Function NSFItemAppend Lib "nnotes" (Byval noteHandle As Long, Byval iFlags As Integer,Byval iName As Lmbcs String,_ Byval iNameLength As Integer, Byval iType As Integer, Byval iValuePointer As Long, Byval iValueLength As Long) As Integer Declare Function OSMemAlloc Lib "nnotes" (Byval T As Integer, Byval S As Long, hM As Long) As Integer Declare Function OSMemFree Lib "nnotes" (Byval hM As Long) As Integer Declare Function OSLockObject Lib "nnotes" (Byval H As Long) As Long Declare Sub OSUnlockObject Lib "nnotes" (Byval H As Long) Declare Sub Poke Lib "kernel32" Alias "RtlMoveMemory" (Byval P As Long, Byval D As Lmbcs String, Byval N As Long) Initialize ---------- Sub Initialize Dim s As New notessession Dim db As notesdatabase Dim doc As notesdocument Dim Strhtml As String Dim HTML as string Dim itemname As String Dim memPtr As Long Dim memLen As Long Dim memhandle As Long Dim StrRecipients As String Dim StrSubject As String Dim rc As Integer Set db = s.currentdatabase Set doc = db.createdocument doc.form = "Memo" 'StrRecipients = "Recipient list goes here" 'I'd like to have this line in the Access code and pass it here as a variable. doc.sendto = StrRecipients 'StrSubject = "Your Monthly file is ready" 'I'd also like to have this line in the Access code and pass it as a variable. doc.subject = StrSubject itemname = "Body" 'I'd like to have the folling line in my Access code as well and pass it here as a variable 'StrHTML = |Hi,<br>Your file can be found at :<b> THE FOLLOWING LINK</b><br>Check this out: <a href="Path and file name go here">Click here to view</a>| html = StrHTML memLen = Len(html) rc = OSMemAlloc( 0, memLen, memHandle) memPtr = OSLockObject(memHandle) Poke memPtr, html, memLen rc = NSFItemAppend( doc.handle, ITEM_SIGN , itemname, Len(itemname), TYPE_HTML, memPtr, memLen) OSUnlockObject memHandle OSMemFree memHandle Call doc.send(False) End Sub Terminate --------- Sub Terminate End Sub

Answer Wiki

Thanks. We'll let you know when a new response is added.

Certainly you can invoke an agent from Access — but you can’t pass parameters to an agent, even from within Notes/Domino, other than the NoteID of a saved NotesDocument. That being said, there’s no need to fire an agent — you have to connect to Notes via COM to invoke the agent anyway, and would need to create a document with which to pass params, so why not create the message directly in your Access code? The COM methods are nearly identical to Lotusscript, the only real difference being how you get a new NotesSession. (If the version of Access you are working with allows early binding and library references, you want to create a reference to Lotus Domino Objects.)

Dim s As NotesSession
Set s = CreateObject(“Lotus.NotesSession”)
Call s.Initialize()

You will also need to grab a database from which to send the mail — any database will do in a pinch. See Lotus Domino Designer Help under LotusScript/COM/OLE Classes -> LotusScript Class coding guidelines -> Accessing the Domino objects through COM for more details.

Discuss This Question:  

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: