delphi - Opening datasource on 1 form in another raises error -


i have delphi project multiple forms in it. on 1 of these forms have dataset contains fields, open dataset on form, following error message i've not seen before :

project raised exception class $c0000005 message access violation @ 0x005f536f:read of address 0x000000e8.

am doing wrong or going wrong way?

any appreciated.

thanks,

code:

uses frm1  procedure tfrm2.formcreate(sender: tobject);  begin   frm1.ds.dataset.open; end; 

code button click on frm1 launch frm2

procedure tfrm1.btncreateclick(sender: tobject); var form2 : tfrm2;     begin   form2 := tfrm2.create(self);   form2.editing := false;   try     form2.showmodal       form2.free;   end; end; 

your code sample demonstrate bad practice:

unit1 using unit2

unit2 using unit1

create datamodule unit , use unit1 , unit2

will this:

unit1 using unit2 , datamodule unit

unit2 using datamodule unit

anyway, code should work. reason why accessviolation -- perhaps have events tadoquery/tadotable and/or tdatasource not listed in code sample


Comments