LotusScript - Setting element in for loop

Posted by Kris.Mitchell on Stack Overflow See other posts from Stack Overflow or by Kris.Mitchell
Published on 2010-05-06T14:20:28Z Indexed on 2010/05/12 7:24 UTC
Read the original article Hit count: 313

Filed under:
|

I have an array set up

Dim managerList(1 To 50, 1 To 100) As String

what I am trying to do, is set the first, second, and third elements in the row

managerList(index,1) = tempManagerName
managerList(index,2) = tempIdeaNumber
managerList(index,3) = 1    

But get an error when I try to do that saying that the object variable is not set. I maintain index as an integer, and the value corresponds to a single manager, but I can't seem to manually set the third element. The first and second elements set correctly.

On the flip side, I have the following code that will allow for the element to be set,

For x=1 To 50
  If StrConv(tempManagerName,3) = managerList(x,1) Then
    found = x 
      For y=3 to 100
        If managerList(x,y) = "" Then                                                                       
          managerList(x,y) = tempIdeaNumber                                                                                             
            Exit for
    End If
      Next

     Exit For
  End If
Next

It spins through the array (laterally) trying to find an empty element. Ideally I would like to set the index of the element the y variable is on into the 3rd element in the row, to keep a count of how many ideas are on the row.

What is the best way to keep a count like this? Any idea why I am getting a Object variable not set error when I try to manually set the element?

© Stack Overflow or respective owner

Related posts about for-loop

Related posts about lotusscript