FOR loop1i=1 TO MaxLoop *GotError = .F. SET DATASESSION TO loop1i ?STR(OldSession) + STR(SET("datasession")) + STR(loop1i) IF SET("datasession") <> OldSession * *** existing datasession MaxLoop = MaxLoop + 1 ReturnValue = ReturnValue + 1 DIME ArrayPointer(ReturnValue, 1) ArrayPointer(ReturnValue, 1) = loop1i OldSession = SET("datasession") ENDIF ENDFORbut the interesting thing is that unlike outside of my error trap, inside of it 'SET DATASESSION TO #' doesn't set didlely zip, therefor no comparing of previous and current DS. RRRRRRRRRRRRR - there just has to be a solution!