Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCAN FOR...... problem
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00175495
Message ID:
00175542
Views:
23
Perry,

Try this variation on your code;
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
ENDFOR
First 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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform