Subject Re: How to avoid many Query of the same table?
Author Marco Menardi <mmenaz@lycosmail.com>
I setup a "general lookup" query and specialize it when needed with a :
ChangeGenericLookupSource( qryGenericLookupQuery,
BaseDataSource,
'BANCHE.BANCA_ID=FORNITORI.BANCA_ID' );



procedure TdmAnagrafiche.ChangeGenericLookupSource(
LookupDataset : TIB_DataSet; AKeySource : TIB_DataSource; AKeyLink
: string; AKeyDescLink : string = '' ; AddSettings : boolean = False );
begin
with LookupDataset do
begin
Close;
KeySource := AKeySource;
if not AddSettings then
begin
KeyLinks.Clear;
KeyDescLinks.Clear;
end;
if AKeyLink <> '' then KeyLinks.Add(AKeyLink);
if AKeyDescLink <> '' then KeyDescLinks.Add(AKeyDescLink);
Prepare;
Open;
end;
end;

regards
Marco Menardi

--- In IBObjects@yahoogroups.com, "Michael Fung <ibo@c...>" <ibo@c...>
wrote:
> Dear All,
>
> I use keylinks and keysource to make up LookupCombo in edit forms.
>
> Now I have a few forms open at the same time, for edit TABLE1,
> TABLE2, TABLE3, and each table has a field COUNTRY_ID reference to
> table COUNTRY. In order to serve all the forms, I need to create 3
> IB_queries of COUNTRY each has its own keyink/keysource setting. That
> makes a lot of "duplicate" queries. Is there a better approach?
>
> Thanks,
> Michael