Philip Ellis
Philip Ellis

Reputation: 39

Undeclared identifier database table not recognized

uses dmInfo;

{$R *.dfm}

procedure TForm3.Button1Click(Sender: TObject);

begin

with dmInfo do

begin

tblInfo.Open;

end;

For some obscure reason, tblInfo is regarded as a undeclared identifier. Please help.

Thanks

Upvotes: 1

Views: 807

Answers (1)

Sertac Akyuz
Sertac Akyuz

Reputation: 54792

Compiler cannot resolve what 'tblInfo' is because you have not qualifed it. It is not something directly in the scope of unit 'dmInfo' but most probably belong to the data module that's in 'dmInfo'. So, say, if your data module's name is 'DataModule', you'd write

with dmInfo.DataModule do

begin

tblInfo.Open;

You can omit the unit name if that wouldn't cause any ambiguity.

with DataModule do

Better yet, start avoiding with now and save yourself from possible obscure problems.

 DataModule.tblInfo.Open;

Upvotes: 4

Related Questions