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

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

Case  |  Loops  |  For

Related Items

Alvechurch Data - Microsoft FoxPro and Access Database Development and Training

Alvechurch Data are based close to Birmingham and provide Microsoft Access and Visual FoxPro training, development and support.

Read More

Autocomplete in Visual Fox Pro

Autocomplete in Visual Fox Pro

The textbox class in Visual FoxPro 9 has a new Autocomplete property which shows the user the previous values that have been entered in that textbox.

Read More

FoxPro Functions

FoxPro has always had functions like FREAD and FWRITE to read and write files at a low level. They can handle files which defeat the STRTOFILE and FILETOSTR functions.

Read More

Development Services

Alvechurch Data are based in Birmingham and specialise in the development of Microsoft Access and Visual FoxPro databases. We have fifteen years experience developing databases for small business use.

Read More

Access and Visual FoxPro Training

Microsoft Access and Visual FoxPro training courses and workshops offered by Alvechurch Data in Birmingham.

Read More