-
I've got this simple Do While Not..Loop structure that should work. It doesn't, and returns an error that there is a 'Loop without Do' - if I remove the loop line I get a 'Do without Loop' error.
This is exactly the same if I try a For..While..Next structure as well.
Can someone please help me out of this paradox!! :confused:
-
A Do loop has the following syntax;
Do {While | Until} condition
[statements]
[statements]
Loop
or
Do
[statements]
[statements]
Loop {While | Until} condition
A While..Wend loop has the following syntax;
While condition
[statements]
Wend
If this helps..
------------------
Mark "Buzby" Beeton
VB Developer
[email protected]
-
Here's my exact code:
If remvar = 3 Then
i = 0
b = 0
Do While Not b = c
Do While Not i = 6
'Do stuff with i
i = i + 1
Loop
b = b + 1
i = 0
Loop
End If
Its the inner Do...Loop that returns the error first - if I remove that loop the other one returns the error.
A few lines above, in the same procedure, there is a almost identical Do...Loop structure that doesn't return any errors...
Has anyone heard of this happening before?
Mafro still :confused:
-
Have you tried it with
Do While i<>6
and
Do While b<>c
?
this may help.
------------------
Mark "Buzby" Beeton
VB Developer
[email protected]
-
I worked it out! I had a If loop within the middle Do loop which was missing its End If at the end.
This was causing VB to think there was an extra 'Loop' inside the If loop where it wasn't needed...
Thanks for trying!
I'll read my code harder next time!