Author: Tomas Rutkauskas
How to view dBase records which are marked for deletion
Answer:
Call the following function on the AfterOpen event of the table. You must include
DBITYPES, DBIERRS, DBIPROCS in the uses clause. To call, send as arguments name of
TTable and True / False depending to show / not show deleted records. Example:
1 procedure TForm1.Table1AfterOpen(DataSet: TDataset);
2 begin3 SetDelete(Table1, TRUE);
4 end;
5 6 procedure SetDelete(oTable: TTable; Value: Boolean);
7 var8 rslt: DBIResult;
9 szErrMsg: DBIMSG;
10 begin11 try12 oTable.DisableControls;
13 try14 rslt := DbiSetProp(hDBIObj(oTable.Handle), curSOFTDELETEON,
15 LongInt(Value));
16 if rslt <> DBIERR_NONE then17 begin18 DbiGetErrorString(rslt, szErrMsg);
19 raise Exception.Create(StrPas(szErrMsg));
20 end;
21 except22 on E: EDBEngineError do23 ShowMessage(E.message);
24 on E: Exception do25 ShowMessage(E.message);
26 end;
27 finally28 oTable.Refresh;
29 oTable.EnableControls;
30 end;
31 end;