Viewing deleted records in DBase tables

In a dBASE table, records are not removed from the table until the table is packed. Until that happens, records that are "deleted" are actually just marked as "to be" deleted. To show these existing but not displayed records, the following function, ShowDeleted(), makes use of a BDE API function, DbiSetProp(), to show records marked for deletion. It is not necessary to close and re-open the table when using this function. ShowDeleted() takes a TTable and a boolean variable as parameters. The boolean parameter determines whether or not to show deleted records.

Example code follows:

procedure TForm1.ShowDeleted(Table: TTable; ShowDeleted: Boolean);
  var
    rslt: DBIResult;
    szErrMsg: DBIMSG;
begin
  Table.DisableControls;
  try
    Check(DbiSetProp(hDBIObj(Table.Handle), curSOFTDELETEON,
    LongInt(ShowDeleted)));
  finally
    Table.EnableControls;
  end;
  Table.Refresh;
end;