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:
00175600
Views:
25
Jim,

I seem to be having a lot of VFP5 problems here at work. A lot of the default functions don't seem to work properly. To save on debugging time I try to use as much precision as I possibly can. I wonder if there's a big difference between Professional and Enterprise. I also encounter problems in the exe file that I don't get in debug mode. I think it's haunted.

thanx


>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.
Perry E. Chrzanowski
Programmer/Analyst
Saturn (Solutions) Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform