I need to prevent a record from being deleted and have tried the following code.
procedure TParentDM.IBdsChildBeforeDelete(DataSet: TDataSet);
begin
with ParentDM.IBdsChild do
begin
if ParentDM.IBdsChildC_NO.value > 0 then
ShowMessage ('Delete forbidden.');
end;
end;
The message comes up fine - but, having hit the "O.K." button, I obviously still need something further to prevent the Delete operation from following through.
Meanwhile I get the following exception having hit the "O.K." button.
'violation of FOREIGN KEY constraint "INTEG_1" on table "CHILD"'. Process stopped. Use Step or Run to continue.
Can someone please throw some light on this?
Thanks in advance.
Terry.