Share via


CONTINUE Command

Continues the previous LOCATE.

CONTINUE

Remarks

CONTINUE is used after LOCATE succeeds in finding a record, to continue the LOCATE operation. CONTINUE moves the record pointer to the next record for which the logical expression specified in the previous LOCATE evaluates to True (.T.).

CONTINUE can be repeated until the end of the file is encountered, or until the end of the scope you specified with LOCATE is reached.

If CONTINUE succeeds in finding a record, RECNO( ) returns the record number of the record, FOUND( ) returns a value of True (.T.), and EOF( ) returns a value of False (.F.).

If CONTINUE doesn't succeed in finding a record, RECNO( ) returns the number of records in the table plus one, FOUND( ) returns False (.F.), and EOF( ) returns True (.T.).

Example

In the following example, all customers from France are counted and the total is displayed. All records are found using one LOCATE command followed by a CONTINUE command within a loop.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer  && Opens Customer table
SET TALK OFF
STORE 0 TO gnCount

LOCATE FOR ALLTRIM(UPPER(country)) = 'FRANCE'
DO WHILE FOUND( )
   gnCount = gnCount + 1
   CONTINUE
ENDDO
? 'Total customers from France: '+ LTRIM(STR(gnCount))

See Also

Reference

EOF( ) Function

FOUND( ) Function

LOCATE Command

SEEK Command

Other Resources

Commands (Visual FoxPro)

Language Reference (Visual FoxPro)