Shawn Pelletier 17.Feb.12 01:10 PM a Web browser Applications Development 6.5.4 Windows XP
I have 2 problems I need to address.
1) Object variable not set
See code below for where it is causing an error. This error message pops up on a Forall statement. It is my understanding that an array needs to be declared as a variant for this to work, which I have done. Not sure why I'm getting this error now.
2) Here is what I'm trying to do:
On a button click I need the script to grab the data from a field on the form and compare it against an array (I have this setup already with an array and Forall statement). The first dimension of the array is the name of a person. The second dimension is their email address. I then want an email sent to the email address that corresponds with the name of the person that was pulled from the array.
So...Joe Dirt populates a field, it checks a 2 dimensional array with his name and email address and then sends sends an email to the address in the array. Hopefully my code explains it better. See below.
I need help with the logic and/or how to grab data from 2nd dimension of array. Any direction would be greatly appreciated.Thank you.
Sub Click(Source As Button)
'Declaring form variables
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
Set db = session.CurrentDatabase
Dim TechArray (1 To 2 ,1 To 2) As Variant
TechArray(1,1) = "Joe Dirt, Joe.Dirt@gmail.com"
TechArray(1,2) = "Jane Doe, Jane.Doe@gmail.com"
'Declare variables for email
Dim CVT_Num As NotesItem
Dim CVT_Clli As NotesItem
Dim CVT_Date As NotesItem
Dim CVT_CCR As NotesItem
Dim CVT_WO As NotesItem
Dim CVT_TEO As NotesItem
Dim Requester As NotesItem
'Set email variables
Set CVT_Num = doc.GetFirstItem("CVTNumber1")
Set CVT_Clli = doc.GetFirstItem("CLLI")
Set CVT_Date = doc.GetFirstItem("Date")
Set CVT_CCR = doc.GetFirstItem("CCR")
Set CVT_WO = doc.GetFirstItem("WorkOrder")
Set CVT_TEO = doc.GetFirstItem("TEO")
Set Requester = doc.GetFirstItem("Requestor")
'Setting up mail doc
Dim AdviseDoc As NotesDocument 'declare variable for new mail document
Dim AdviseRtitem As NotesRichTextItem 'declare variable for richtext Item
Dim richStyle As NotesRichTextStyle
Set richStyle = session.CreateRichTextStyle
'Send email message
Forall TechValue In Requester.Values <=================Object variable not set
If Not Isnull(Arraygetindex(TechArray, TechValue)) Then
'This line sends the email
Call AdviseDoc.Send( False, "email address of tech in array") <======== How do I grab email address from array index that was chosen?