Determines whether the most recently executed CONTINUE, FIND, LOCATE, or SEEK command was successful or if the record pointer was moved in a related table.
|You can use FOUND(В ) to determine if a child table has a record that matches the parent record.|
FOUND([nWorkArea | cTableAlias])
- Specifies the work area of the table that the most recent CONTINUE, FIND, LOCATE, or SEEK command was called on.
Specifies the alias of the table that the most recent CONTINUE, FIND, LOCATE, or SEEK command was called on.
Note: If you specify a table alias that does not exist, Visual FoxPro generates an error message.
Logical. FOUND(В ) returns True (.T.) if the most recent CONTINUE, FIND, LOCATE, or SEEK command was successful; otherwise, it returns False (.F.). If a table is not open in the work area you specify, FOUND(В ) returns False. When FOUND(В ) encounters an end-of-file, which can be determined by the EOF(В ) function, it always returns False.
If you call FOUND(В ) without arguments, FOUND(В ) is called on the table open in the currently selected work area.
The following example locates and counts all customers whose Country field in the Customer table contains "GERMANY". CLOSE DATABASES closes all databases, and OPEN DATABASE opens the sample Visual FoxPro database, TestData.dbc. USE opens the Customer table.
STORE stores a value of 0 in the variable gnCount. LOCATE searches for the first record in which the Country field contains the value "GERMANY". The DO WHILE loop increments the variable gnCount by 1 and uses CONTINUE to perform another LOCATE operation. When there are no more matching records, the total number of customers is displayed.
CLOSE DATABASES OPEN DATABASE (HOME(2) + 'Data\TestData') USE Customer STORE 0 TO gnCount LOCATE FOR UPPER(Country)='GERMANY' DO WHILE FOUND() gnCount = gnCount + 1 CONTINUE ENDDO ? "Total customers from Germany: "+LTRIM(STR(gnCount))