>Yep, it is really strange....So when lz=4 and tTotime=12:15pm lx starts at 1, steps to 2 and 3 and then steps to 4 for after the ENDFOR without operating inside the loop for lx=4....lx is never changed inside the loop...I have also tried other names for lx, i.e. x, y, etc. even Peter.....and again only for tTotTime=12:15pm.....I just don't understand it....
>
Peter,
It doesn't make any sense. If lz=4 rhan ix should be 5 after the loop. Did you try to drop indexes on the 'sched' table and recreate them from scratch?
--sb--