Determine the number of records in the current .dbf file

     LASTREC() | RECCOUNT()* --> nRecords


     LASTREC() returns the number of physical records in the current database
     file as an integer numeric value.  Filtering commands such as SET FILTER
     or SET DELETED have no effect on the return value.  LASTREC() returns
     zero if there is no database file in USE in the current work area.


     LASTREC() is a database function that determines the number of physical
     records in the current database file.  LASTREC() is identical to
     RECCOUNT() which is supplied as a compatibility function.

     By default, LASTREC() operates on the currently selected work area.  It
     will operate on an unselected work area if you specify it as part of an
     aliased expression (see example below).

     Note:  Although the functionality of RECNO() has been expanded to
     encompass the concept of "identity," the LASTREC() function continues to
     return only record numbers--not identities.  LASTREC() has no expanded
     functionality, so it is not "identity-aware."


     .  This example illustrates the relationship between LASTREC(),
        RECCOUNT(), and COUNT:

        USE Sales NEW
        ? LASTREC(), RECCOUNT()            // Result: 84 84
        SET FILTER TO Salesman = "1001"
        COUNT TO nRecords
        ? nRecords, LASTREC()            // Result: 14 84

     .  This example uses an aliased expression to access the number
        of records in a open database file in an unselected work area:

        USE Sales NEW
        USE Customer NEW
        ? LASTREC(), Sales->(LASTREC())

 Files   Library is CLIPPER.LIB.

See Also: COUNT EOF()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.