GKChesterton
Programmer
I am adding records to an array called arrayNeedles. For each value strNeedle, I need to know if it is already in the array or not.
The only way I know to do this:
Maybe I'm just spoiled on the array functions for PHP, but seems to me there ought to be a simpler way. Any suggestions?
The only way I know to do this:
Code:
Dim lngUbound As Long
lngUbound = UBound(arrayNeedles, 2)
Dim i As Long
For i = 0 To lngUbound
If arrayNeedles(0, i) Like strNeedle Then
'Gotcha! Now I edit arrayNeedles(1, i)
arrayNeedles(1, i) = arrayNeedles(1, i) + 1
Exit Property
End If
Next
' Hmm, I never made it to the Exit
' ... must have to add this as a new record
i = lngUbound + 1
ReDim Preserve arrayPN(1, i)
arrayNeedles(0, i) = strNeedle
arrayNeedles(1, i) = 1
Maybe I'm just spoiled on the array functions for PHP, but seems to me there ought to be a simpler way. Any suggestions?
[purple]If we knew what it was we were doing, it would not be called
research [blue]database development[/blue], would it? [tab]-- Albert Einstein[/purple]