Subject | Re: [IBO] please help IsModified cause Access Violation |
---|---|
Author | send2iwan |
Post date | 2007-01-10T08:30:53Z |
thanks for reply. and that's very fast.
i just looking to:
http://tech.groups.yahoo.com/group/IBObjects/message/18446
and try to make that code in my project and av comes.
but now i'm moving that code to onValidateField and it's works.
i just looking to:
http://tech.groups.yahoo.com/group/IBObjects/message/18446
and try to make that code in my project and av comes.
but now i'm moving that code to onValidateField and it's works.
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@...> wrote:
>
> At 06:12 PM 10/01/2007, you wrote:
> >i am trying this
> >
> >procedure TForm1.IB_DataSource1DataChange(Sender:
TIB_StatementLink;
> >Statement: TIB_Statement; Field: TIB_Column);
> >begin
> > if Field.FieldName = 'SAMPLE' and Field.IsModified then
> > begin
> > // modified another fields
> > end;
> >end;
> >
> >and AV comes.
> >
> >how to fix this?
>
> Well, you haven't shown the code that is causing the AV, but is it
> anything like the following?
>
> procedure TForm1.IB_DataSource1DataChange(Sender: TIB_StatementLink;
> Statement: TIB_Statement; Field: TIB_Column);
> begin
> if Field.FieldName = 'SAMPLE' and Field.IsModified then
> with Statement do
> begin
> FieldByName('AnotherField').Value := SomethingCompatible;
> FieldByName('................
> ..........;
> end;
> end;
>
> There is a danger of this kind of thing going into a loop if your
> OnDataChange procedure is targetting multiple fields, since the
event
> would fire again once your routine altered another field and moved
> on. It's a valid approach sometimes but it does require some
care...
>
> Also make sure that your code is not attempting to assign values to
> any fields that are non-updatable for any reason, e.g. derived
> values, calculated fields or in any situation where you have joins
> without any EditSQL or KeyRelation defined that permits a
particular
> field to be updated.
>
> If these things don't seem applicable, show the code that's causing
> the AV and also the addresses that are reported in the AV message.
>
> Helen
>