>CLOSE all >use aliq excl >*index on no tag no >*set order to "no" >for i = 1 to 20 && assume 20 values for flag > * seek i &&Table has no index order set > LOCATE FOR no=i && this is what i add > copy next 5 to temp while no = i >use aliq1 > append from temp >use aliq excl > >next >LOCATE can be much slower. Besides, if the table is not ordered, records for the same flag are not necessarily contiguous (one after another). You should try to make SEEK work.