Click to See Complete Forum and Search --> : [RESOLVED] finding distinct element from an array


makdu
November 8th, 2009, 12:57 AM
Hi,
i have an array with wild character at the end. I use the value in this array in Select statment. Some times the array has same values. I want only distinct values in the array before the select statment. Can some one throw an idea on how to do this

for i=0 to count
select * from tbl where item like ' " & itemname(i) & "'
next


I need distinct element in itemname array

makdu
November 8th, 2009, 02:12 AM
Found the solution

For i = 0 To cno
notfoundelement = True
For j = 0 To cno
If itemname(i) = sortarray(j) Then
notfoundelement = False

End If
Next
If notfoundelement = True Then
sortarray(elementcount) = itemname(i)
elementcount = elementcount + 1

End If
Next