Database development and training for Birmingham and the midlands
Specialists in Microsoft Access and Visual Foxpro database training and development
I am happy to hear from existing clients but I am taking no new calls.
FoxPro Scan command
FoxPro has a specialist type of loop specifically for processing data in tables. The Scan loop steps through the a recordset and executes the statements in the loop body for each record. Its simplest form is equivalent to a While loop:
* Move to first record then loop until we hit end of file
Go Top
Do While Not Eof()
* Process this record
Skip && Move to next record
EndDo
Go Top
Do While Not Eof()
* Process this record
Skip && Move to next record
EndDo
It is however more flexible than a While loop because the Scan can accept any of the scope clauses which will select which records are to be processed. As an example, this Scan loop will only process those records which are after the current position of the record pointer and which have the cost field greater than 1,000:
Scan Rest For cost > 1000