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.
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)
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)
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!