PROCEDURE delete LOCAL lnRetVal, laError[AERROR_NUMCOLUMNS], lnOldArea lnRetVal = FILE_OK lnOldArea = SELECT(0) *-- Delete the current record. DELETE *-- If we are using TABLE buffering, then we assume that the user will *-- have the ability to REVERT all deleted records. Therefore, do not *-- issue a TABLEUPDATE(). IF INLIST(CURSORGETPROP("BUFFERING"), DB_BUFOPTRECORD, DB_BUFLOCKRECORD) ; AND !TABLEUPDATE() SELECT (lnOldArea) *-- Undo the changes made to the buffer ... the deletion TABLEREVERT() *-- Return error number of what went wrong AERROR(laError) lnRetVal = laError[AERROR_ERROR] ELSE *-- If you are using record buffering or no buffering IF !EOF() *-- Get off of the deleted record SKIP IF EOF() *-- If the record you deleted was the last record, *-- reposition yourself on the new last record. SKIP -1 IF !BOF() *-- Return that the operation was successful. lnRetVal = FILE_OK ELSE *-- If you deleted the last record, indicate so. lnRetVal = FILE_NORECORDS ENDIF ENDIF ENDIF ENDIF SELECT (lnOldArea) RETURN lnRetVal