Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Moving next record
Message
 
To
02/05/2002 15:17:52
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00652072
Message ID:
00652248
Views:
18
James,

I know you got the solution to this but I thoght you might want to understand why the code you posted did not work. LOCATE starts at the top of the file unless you use the REST keyword. Now to midify your original code so it will work for you ...
select a_alias
* Things will be faster if you do not set the order, 
* unless of course you need to index for something
set order to tagname
* Find your first match
locate for field1 = variable and field2 = variable2
DO while FOUND() &&This loop will continue until the LOCATE fails
  do some stuff
  CONTINUE  && This is the command to find the next record that matches your locate condition
ENDDO  && this is the correct command to close a DO WHILE loop
Now the SCAN/ENDSCAN suggestion is a better way to do what you want. The reason your code failed is that each time you looped back and executed the LOCATE it started from the top of the file again.
Previous
Reply
Map
View

Click here to load this message in the networking platform