Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Break

Status
Not open for further replies.

kafmil

Technical User
Jul 15, 2002
71
AU
I have a while loop that I want to break out of when a certain condition becomes true. Itried it like this:

while InStr(keywords, " ")
bob = InStr(keywords, " ")
keyword(i) = Mid(keywords,1,bob)
keywords = MID(keywords, (bob+ 1), LEN(keywords))
IF keyword(i)="" Then
k = k+1
Wend
END IF
Wend

But it doesn't work. Is there a break function or something similar.
Thanks
 
I'm afraid c'est n'est pas possible!! all the francais i know!! why dont to look into using the 'Do...While...Loop' block... where you can exit the loop by using an 'Exit do'

heres a key?

Dim Check, Counter
Check = True: Counter = 0 ' Initialize variables.
Do ' Outer loop.
Do While Counter < 20 ' Inner loop.
Counter = Counter + 1 ' Increment Counter.
If Counter = 10 Then ' If condition is True...
Check = False ' set value of flag to False.
Exit Do ' Exit inner loop.
End If
Loop
Loop Until Check = False ' Exit outer loop immediately. Sham aka boolean... be practical/be straight... true/false?!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top