Subject Re: Access Violation
Author mitch_landor
Tony,

Yes that was it!

Many thanks, I would never have got this without assistance.

Mitch


--- In IBObjects@yahoogroups.com, "Tony Masefield" <polsolsa@...> wrote:
>
> Hi Mitch,
>
> Just a thought:
> Is your DataModule created before your Form2? (Project Options). If
> not your form2 is trying to connect to a component (database) that
> doesn't exist yet.
> Rgds,
>
>
> --- In IBObjects@yahoogroups.com, "mitch_landor" <mlq97@> wrote:
> >
> > I'm using TIBO objects and a TdbGrid. I had this running OK before,
> > now I keep getting this message:
> >
> > "First chance exception at $7C81EB33. Exception class
> EAccessViolation
> > with message 'Access violation at address 00520870 in module
> > 'TestProj02.exe'. Read of address 00000058'. Process TestProj02.exe
> > (3212)"
> >
> > After I "continue" in the debugger, the form runs OK and I can edit
> > the data.
> >
> > Any idea why this might be?
> >
> > Many Thanks
> > Mitch
> >
> >
> > Here is the datamodule:
> > =======================
> > unit flnmDataModule;
> >
> > interface
> >
> > uses
> > SysUtils, Classes, DB, IBODataset, IB_Components;
> >
> > type
> > TDataModuleTest = class(TDataModule)
> > IBODatabase1: TIBODatabase;
> > IBOQuery1: TIBOQuery;
> > DataSource1: TDataSource;
> > private
> > { Private declarations }
> > public
> > { Public declarations }
> > end;
> >
> > var
> > DataModuleTest: TDataModuleTest;
> >
> > implementation
> >
> > {$R *.dfm}
> >
> > end.
> >
> >
> >
> > Here is the form:
> > =================
> > unit Main;
> >
> > interface
> >
> > uses
> > Windows, Messages, SysUtils, Variants, Classes, Graphics,
> Controls,
> > Forms,
> > Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids;
> >
> > type
> > TForm2 = class(TForm)
> > DBGrid1: TDBGrid;
> > DBNavigator1: TDBNavigator;
> > procedure FormCreate(Sender: TObject);
> > private
> > { Private declarations }
> > public
> > { Public declarations }
> > end;
> >
> > var
> > Form2: TForm2;
> >
> > implementation
> >
> > uses flnmDataModule;
> >
> > {$R *.dfm}
> >
> > procedure TForm2.FormCreate(Sender: TObject);
> > begin
> > with DataModuleTest do
> >
> > begin
> > if not IBODatabase1.Connected then
> > IBODatabase1.Connect;
> >
> > if not IBOQuery1.Active then
> > begin
> > IBOQuery1.Prepare;
> > IBOQuery1.Open
> > end;
> > end;
> > end;
> >
> > end.
> >
>