SELECT myTable1 FOR I = 1 TO ALEN(myArray1) FOR J = 1 TO ALEN(myArray2) SCAN FOR myField1 = myArray1(I) AND myField2 = myArray2[J] SELECT myTable2 locate for myField1 = myVar . . . ENDSCAN ENDFOR ENDFORFirst SCAN has an implicit WHILE NOT EOF() so you don't need it. Second you can combine the two conditions into one SCAN FOR expression. Third the locate needs to be done in a different work area so select that area first. Fourth there's no need to reselect the work area being scanned as that is automatically done by ENDSCAN. Finally, SCAN always starts at the top of the table unless you use an explicit WHILE condition or use the REST keyword, so the GO TOP's are not required.