Subject Re: [IBO] Posting a new record in a Dataset linked to a TIB_Grid
Author Roberto Freitas
Helen, actual code for IB_QueryContaAfterInsert event is:
with IB_QueryConta do
begin
...
FieldByName('cct_ciireg').AsString := Gl_ciireg_f;
...
end;
Gl_ciireg_f is not a constant.
I checked that the code actually executes. If immediately after
execution of that line code I watch
FieldByName('cct_ciireg').AsString
the value is correct = '10010001'
But, as I said before, I get that mencioned ISC ERROR CODE when
trying to post the record.


--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 10:19 AM 15/09/2005 +0000, you wrote:
> >I am using a TIB_Grid linked to a TIB_DataSource and a TIB_Query.
> >I have this code at IB_QueryContaAfterInsert event:
> > FieldByName('REGH').AsString := '10010001';
> >For a new record, the user types values for other fields on the
> >TIB_Grid. Field REGH is not visible on the grid, so user cannot
change
> >it. When posting record, I got this ISC Error Message:
> > ISC ERROR CODE: 335544347
> > validation error for column REGH, value "***null***"
> >How can it happens, since the field was assigned to '10010001' at
> >AfterInsert event?
>
> Notice the argument ((IB_Dataset: TIB_Dataset)
>
> procedure TdmMyDm.IB_QueryContaAfterInsert(IB_Dataset: TIB_Dataset);
> begin
> IB_Dataset.FieldByName('REGH').AsString := '10010001';
> end;
>
> Note also that, if all inserts are to receive the same value, you
can set
> that value as a default in the Fields Attributes.
>
> Helen