exiting a while wend loop?

tranchemontaigne

Registered User.
Local time
Today, 13:40
Joined
Aug 12, 2008
Messages
203
I'm having difficulty breaking a While Wend loop and can't seem to recall the keywork necessary to do this elegantly.

I initially tried "Exit While", then "End While", before reviewed reference materials and google.

I find that "Exit While" is the keyword most often cited in these sources.

For some reason this these command won't compile in my MS Access database...has anyone encountered this before? Is this a sign of corruption?

I've worked around the issue by setting the value of the While Wend control variable to something that will break the loop during the next pass, but would like a quick refresher.

Any help would be appreciated.
________
BUY VAPORIZER
 
Last edited:
Code:
While (somecondition = True)
Dostuff()
Wend

Code:
Do While (somecondition = True)
Dostuff()
If Someothercondition = True Then Exit Do
Loop

Code:
Do Until (somecondition = True)
Dostuff()
If Someothercondition = True Then Exit Do
Loop
 
i rarely use do loop at all, and generally get by with while wend, and for next loops

if i need to break a loop a would just jump to a label outside the loop
however generally i would have thought that if the loop is not terminating because of the state of the test condition, then there is something wrong with the logic

the only exception is where you deliberately have something like

while true
statements
wend

where you would HAVE to jump outside the loop to break it.

while .. wend, is deifferent from
repeat ... until

in that repeat until will execute once, but
while wend may not execute at all
 

Users who are viewing this thread

Back
Top Bottom