Hi there,
I'm using the line: For x = 1 to Variable, where Variable is a integer.
Now it all works well but if a certain condition happens, then Variable can
go up by 1.
Now Variable will show that it has indeed gone up by one BUT the: For x = 1
to Variable, will still go by the orginal number not the amended number.
Has anyone run into this before and know a way to get it to work the way
that I would like it to?
Thanks
Lythandra - 08 Nov 2006 19:58 GMT
Nevermind,
I just called the sub again then put an "Exit Sub" right behind it.
It may not be exacly the way I want it to work but as long as it works. :-)
> Hi there,
>
[quoted text clipped - 10 lines]
>
> Thanks
Roger Carlson - 08 Nov 2006 20:01 GMT
Instead of a For...Next loop, use a Do While...Loop
x=1
Do While x < Variable
'body of the loop
x=x+1
Loop

Signature
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
> Hi there,
>
[quoted text clipped - 10 lines]
>
> Thanks
Stefan Hoffmann - 09 Nov 2006 09:33 GMT
hi,
> I'm using the line: For x = 1 to Variable, where Variable is a integer.
This line is evaluated once.
> Now it all works well but if a certain condition happens, then Variable can
> go up by 1.
This change can't be reflected for the loop, because it will not
reevaluate the loop header.
> Has anyone run into this before and know a way to get it to work the way
> that I would like it to?
Use Roger's solution.
mfG
--> stefan <--