*:****************************************************************************** *: *: Procedure TABLEDELETE *: *:****************************************************************************** FUNCTION TABLEDELETE(lnRecord,lcAlias) *-- If the alias was not passed, assume the current work area IF empty(lcAlias) lcAlias = alias() ENDIF *-- If no alias passed and no file open in current work area, return .F. IF empty(lcAlias) RETURN .f. ENDIF *-- If no record is specified in lnRecord, assume the current record IF EMPTY(lnRecord) lnRecord = RECNO(lcAlias) ENDIF *-- Delete the record specified in lnRecord DELETE FOR RECNO() = lnRecord IN (lcAlias) *-- If the recore was successfully deleted, update the packlist IF DELETED(lcAlias) UPDATEPACKLIST(lcAlias,1) RETURN .t. ENDIF RETURN .f. *:****************************************************************************** *: *: Procedure UPDATEPACKLIST *: *:****************************************************************************** LPARAMETERS lcAlias, lnAction *-- lnAction codes are 1 = Add, 2 = Delete LOCAL i ; && loop counter lnReccount *-- Store the packlist reccount() to a local var to avoid repeated calls * to the reccount() function. lnReccount = RECCOUNT("packlist") IF lnReccount > 0 *-- See if lcAlias is already in the packlist FOR i = 1 TO lnReccount IF LOWER(fcTableName) = LOWER(lcAlias) EXIT ENDIF NEXT IF i <= lnRecCount *-- table is already in the list, and action requested is * delete. Since the table name is already in the list, if the * action requested is add, no additional action is necessary. IF lnAction # 1 TABLEDELETE("packlist",i) ENDIF ENDIF ELSE IF lnAction = 1 && Add record INSERT INTO packlist (lcTableName) VALUES (lcAlias) ENDIF ENDIF RETURNSince I just banged this code out from memory, I must disclaim an responsibility for syntax and other errors -- but it should look something like this.