
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.
Visual FoxPro Scan command
FoxPro has an unusual 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
This is however more flexible than a While loop because the Scan can accept a For clause which will select which records are to be processed. The loop statement below will only process those records where the cost field is greater than 1,000:
Scan For cost > 1000