>>I think I'm close, I need to do a check before continue on to next step, if I use a Do while I get into a loop I can't get out of and if I use IF it continues on.
>>
>>I have a start date that needs to greater than the end date so here are the ways of written:
>> Thanks
>>
>>if startdate > enddate then
>> messagebox("whatever...)
>>endif
>>
>>do while startdate > enddate
>> messagebox("whatever...)
>> loop
>> exit
>>enddo
>>
>
>LOOP or EXIT will go to the beginning, or after the end, of a DO WHILE, but not of an IF. You can have IF within DO WHILE:
>
>
>do while (some condition)
> aaa
> bbb
> ccc
> if (some other condition)
> exit
> endif
> ddd
> eee
> fff
>enddo
>
>
>Here, EXIT will go after the ENDDO, and DO WHILE will go back to the DO WHILE immediately.
Hilmar, should that be:
Here, EXIT will take execution to the first line after the ENDDO, and
LOOP will take execution back to the DO WHILE statement (just as if processing had got to the ENDDO.
censored.