Visit our new web pages

We have launched a new extended set of web pages at www.alvechurchdata.co.uk. These old pages will stay on the server because people still have links to them but they will not be updated.

The new version of this page is at www.alvechurchdata.co.uk/hints-and-tips/fox101scan.html.

VFP Tutorial - Scan ... EndScan loop


A scan loop processes records in a table. The commands within the loop are executed once for every record in the current work area:

*-- The staff table holds managers and employees
Use Staff In 0

*-- Modify salaries and bonuses
Scan
   If Title = 'manager'
     *-- More money for managers
     Replace Salary With Salary * 1.10
     Replace Bonus With 10000
   Else
     *-- No rise or bonus for the other employees
     Replace Bonus With 0
   EndIf
EndScan

The code in this example will modify every record in the Staff table and reward the managers.

Notes

This example shows how one control structure can be embedded within another. The If structure is executed once for every record in the table.

Back to FoxPro program control .


Introduction | Environment | Project | Tables | Forms | Navigation | Executable


Hints & tips

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.
Autocomplete in VFP 9

Your Access database will look more impressive if you add custom toolbars...
Custom toolbars

FoxPro has always had functions to read and write files at a low level...
Foxpro low level file functions

More...
More pages of hints and tips for users of Microsoft FoxPro and Access databases.

Site Map