Link to home
Start Free TrialLog in
Avatar of tomrwilson
tomrwilsonFlag for Canada

asked on

Why can't I "Exit While"?

Fairly self-explanitory and I'm sure an easy question.  Example:

while rsTest.EOF = False
    if rsTest!id = 1 then exit while
    rsTest.movenext
wend

According to Microsoft, from the MSDN VB6 reference for the "Exit" keyword:

"While
Immediately exits the While loop in which it appears. Execution continues with the statement following the End While statement...."

So why, when I use "Exit While" does VB say "Syntax Error"?  If I can't use it (why would MS say I can?) what alternative can I use?  (I hate goto's but will use them if I have to)


Thanks!
(oh, VB6/SP5/W2000)
ASKER CERTIFIED SOLUTION
Avatar of aeklund
aeklund

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Éric Moreau
because it is an old syntax that can be replaced with :

do while rsTest.EOF = False
    if rsTest!id = 1 then exit do
    rsTest.movenext
loop
Avatar of tomrwilson

ASKER

Duh. :)  Thanks (to both).  Sorry to the other commenter, I picked the answer posted first.
Avatar of aeklund
aeklund

Glad to help...