Freigeben über


EOF( ) Function

Determines whether the record pointer is positioned past the last record in the current or specified table.

EOF([nWorkArea | cTableAlias])

Return Values

Logical

Parameters

  • nWorkArea
    Specifies the work area number of the table.

  • cTableAlias
    Specifies the alias of the table.

    EOF( ) returns false (.F.) if a table isn't open in the work area you specify.

    If you do not specify a work area or alias, the table that is open in the currently selected work area is tested for the end of the table condition.

Remarks

EOF( ) returns true (.T.) if the record pointer reaches the end of the table file (EOF). The end of the table is reached when the record pointer passes the last record in the table. For example, when a FIND, LOCATE, or SEEK is unsuccessful, Visual FoxPro moves the record pointer past the last record, and EOF( ) returns true (.T.). EOF( ) returns false (.F.) if the record pointer isn't at the end of the table.

Example

The following example opens the customer table and lists the company name one page at a time until the end of the file is reached or you until you choose Cancel.

CLOSE DATABASES
CLEAR
OPEN DATABASE (HOME() + "samples\data\testdata")
USE customer
GO TOP
local recCtr, btnValue
recCtr = 0
btnValue = 1
DO WHILE btnValue = 1 AND NOT EOF()
  ? "Company : " + company
  recCtr = recCtr + 1
  if (recCtr % 20) = 0 then
    btnValue =MESSAGEBOX ("Click OK to continue, ;
     Cancel to quit.",33)
    clear
  endif
  Skip 1    && Move down one record
ENDDO
=MESSAGEBOX("Listing complete.",48)

See Also

BOF( ) | GO | GOTO | SKIP