Here is an example of trapping an SQL system message and presenting your own message:
function OnSQLException(Sender: TObject; Msg: string; SQL: string): boolean;
begin
// exception from button Form1.Button1
if Sender = Form1.Button1 then
begin
if Pos('FOREIGN KEY constraint failed', Msg)=1 then
begin
result := True; // to prevent system message
MessageBox('Your customized message here', 'Error', MB_OK+MB_ICONERROR);
end;
end;
end;
Another way to do it is to check, through script, the existence of child records before you attempt the delete of the parent. And if they exist then present your own message.