Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to cancel DELETE in ADOTable1.BeforeDelete?

Status
Not open for further replies.

Delphard

Programmer
Jul 22, 2004
144
RS
Need to prevent DELETE if some condition is satisfied in ADOTable1.BeforeDelete event. But, ADOTable1.Cancel doesn't work (Record is deleted). Any idea?
 
Hey there.

Code:
procedure ... 
// this is your routine that calls to Post method 
// of your Table
begin
  ...
  try
    ADOTable1.Post;
  except 
    ADOTable1.Cancel;
  end;
  ...
end;

procedure ADOTable1BeforePost(...);
begin
  ...
  if (not <your condition>)then
   Abort();
  ...
end;
HTH

--- McMerfy
 
Abort() was that I missed...
Thanks McMerfy!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top