Counts the number of records that match specified conditions.

Syntax

COUNT
[<scope>]
[FOR <condition 1>]
[WHILE <condition 2>]
[TO <memvar>]

<scope>
FOR <condition 1>
WHILE <condition 2>

The scope of the command. The default scope is ALL.

TO <memvar>

Stores the result of COUNT, a number, to the specified variable (or property).

Description

Use COUNT to total the number of visible records. The current index, filter, key constraints, DELETED setting, and other factors control which records are visible at any time. You may specify further criteria with the <scope> and FOR and WHILE conditons.

If the COUNT is not stored to a memvar, the result is displayed in a dialog box. If the COUNT is stored to a memvar and SET TALK is ON, the result is also displayed in the status bar.

COUNT automatically locks the table during its operation if SET LOCK is ON (the default), and unlocks it after the count is finished. If SET LOCK is OFF, you can still perform a count; however the result may change if another user changes the table.

You can also count the total number of records in a table using the RECCOUNT(†) function. However, unlike COUNT, RECCOUNT(†) does not let you specify conditions to qualify the records it counts.

OODML

Use the Rowset objectís count(†) method.