Subject Re: [IBO] IBOQuery and Abort in OnValidate event
Author Jason Wharton
I believe that I was able to fix this problem by doing this:

procedure TIBODataset.DoOnNewRecord;
begin
GetValuesFromMaster;
try
inherited DoOnNewRecord;
except
FRecAppended := false;
InternalDataset.Cancel;
raise;
end;
end;

I added the catch of an exception and am cleaning up the internal dataset so
that it will stay consistent with what the wrapper TDataset is expecting.

Please test this and let me know what you think.

Thanks,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Petr Hartman" <petr.hartman@...>
To: <IBObjects@yahoogroups.com>
Sent: Friday, January 26, 2001 7:44 AM
Subject: [IBO] IBOQuery and Abort in OnValidate event


> Hi all,
>
> I am trying to work with IBO and I have a problem.
>
> Example:
>
> procedure TForm1.IBOQuery1NewRecord(DataSet: TDataSet);
> begin
> IBOQuery1Poj.Value := '111';
> end;
>
> procedure TForm1.IBOQuery1PojValidate(Sender: TField);
> begin
> if (IBOQuery1Poj.Value = '111') then
> raise Exception.Create('Error');
> end;
>
> When I add a new record, OnValidate event fires, the value '111' is not
stored into the new record,
> but the new record remains in IBOQuery's buffer. When I skip to the next
record and call Edit,
> I get error message like this:
>
> IBOQuery1: Dataset not in edit or insert mode.
>
> With standard TQuery everything is ok (new record isn't added).
>
> Thank you for your answer and sorry for my bad english.
>
> Petr Hartman
>
>
>
>
>