RECNO( ) Function Example

The following example searches the customer table for a company name, and, if the company name isn't found, uses RECNO(0) to return the closest matching company.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'data\testdata')
USE customer  && Opens Customer table
SET ORDER TO company
SEEK 'Ernst'
IF FOUND( )
   DISPLAY company, contact
ELSE
   GOTO RECNO(0)
   CLEAR
   ? 'Closest matching company is ' + company
   ? 'Record number: ' + ALLTRIM(STR(RECNO( )))
ENDIF