Click to See Complete Forum and Search --> : Searching in an array?


azura107
April 12th, 2001, 12:43 AM
im searching for a suburb in an array, and i can find it and print the first home in that suburb, but i can't print the other homes, i have tryed a few statements but all i get is the same listing printed over and over, any help? thanks
Private Sub cmdSuburb_Click()
I = 0
Found = False
strSuburb = InputBox("Please enter the suburb.")
Cls
While (Found = False) And (I <= dblNum)
I = I + 1
If Trim(gSuburb(I)) = strSuburb Then
Found = True
End If
Wend
If Found Then
Print gStreetNum(I); Tab(13); gStreetName(I); Tab(34); gSuburb(I); Tab(59); gPostalCode(I); Tab(74); gPrice(I)
Else
MsgBox "This suburb does not exist."
End If

End Sub

Mutatrix
April 12th, 2001, 01:26 AM
Why dont you try this :

I = 0
Found = False
strSuburb = InputBox("Please enter the suburb.")
Cls
While (I <= dblNum)
I = I + 1
If Trim(gSuburb(I)) = strSuburb Then
Found = True
Print gStreetNum(I); Tab(13); gStreetName(I); Tab(34); gSuburb(I); Tab(59); gPostalCode(I); Tab(74); gPrice(I)
End If
Wend
If not Found Then
MsgBox "This suburb does not exist."
End If

End Sub