tomrwilson
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)
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Duh. :) Thanks (to both). Sorry to the other commenter, I picked the answer posted first.
Glad to help...
do while rsTest.EOF = False
if rsTest!id = 1 then exit do
rsTest.movenext
loop