Subject Re: [IBO] OT: String->Query
Author guido.klapperich@t-online.de
Thanks Markus, that's exactly, what I have been looking for. But only my MainForm
has the owner Application, I thought every form has this owner ?

Guido

Markus Ostenried wrote:

> Hi Guido !
>
> If your DataModules all have the Owner "Application" you can do something like:
>
> function FindQuery( AName: String ): TIB_Query;
> var
> p, i, j : Integer;
> sDataModule, sQuery: String;
> DM : TDataModule;
> begin
> Result := nil;
> p := Pos( '.', AName );
> if (p = 0) then Exit;
> sDataModule := Copy( AName, 1, p-1 );
> Delete( AName, 1, p );
> sQuery := AName;
> for i := 0 to Application.ComponentCount-1 do begin
> if (Application.Components[i].Name = sDataModule) then begin
> DM := (Application.Components[i] as TDataModule);
> for j := 0 to DM.ComponentCount-1 do begin
> if (DM.Components[i].Name = sQuery) then begin
> Result := (DM.Components[i] as TIB_Query);
> Break;
> end; // if Com.Name = sQuery
> end; // for j
> end; // if Com.Name = sDataModule
> end; // for i
> end;
>
> not tested - just coded....
>
> HTH,
> Markus
>
> At 23:14 08.04.2001 +0200, you wrote:
> >I have a string 'CustomersDataModule.CSQuery' and I want to convert this
> >string to a IB_Query.
> >I want something like that:
> >
> >var Query; TIB_Query;
> >begin
> > Query:=Convert('CustomersDataModule.CSQuery');
> > Query.Open;
> >end;
> >
> >Is this possible ?
> >
> >
> >Guido.
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/