Subject Dynamic Master Detail SQL
Author sdbeames
Hi all,
I'd like to dynamically change the SQL of my Master & Detail
TIBOQuerys (used to interface to FreeReport 2.34 components),but I get
an error complaining that the Detail query can no-longer find the
fields from the first SQL query it used when it was first opened. How
can I tell it to forget about the first query's fields?

IBOQuery2->Datasource = Datasource1.
I start with this (via a button)...

IBOQuery1->Close();
IBOQuery1->Unprepare();
IBOQuery1->SQL->Clear();
IBOQuery1->SQL->Add("SELECT CAT1NO, CAT1 FROM CATEGORY1 where
DEPT='EWS'");
IBOQuery1->Prepare();
IBOQuery1->Open();

IBOQuery2->Close();
IBOQuery2->Unprepare();
IBOQuery2->SQL->Clear();
IBOQuery2->SQL->Add("SELECT CAT2NO, CAT2 FROM CATEGORY2 where
CAT1NO=:CAT1NO");
IBOQuery2->Prepare();
IBOQuery2->Open();

and all is good. Then ...

IBOQuery1->Close();
IBOQuery1->Unprepare();
IBOQuery1->SQL->Clear();
IBOQuery1->SQL->Add("select CAT2NO,CAT1NO,CAT2 from CATEGORY2 where
CAT1NO < 200");
IBOQuery1->Prepare();
IBOQuery1->Open();

IBOQuery2->Close();
IBOQuery2->Unprepare();
IBOQuery2->SQL->Clear();
IBOQuery2->SQL->Add("select CAT3 from CATEGORY3 where CAT2NO=:CAT2NO");
IBOQuery2->Prepare();
IBOQuery2->Open();

give the error that "IBOQuery2: Field 'CAT2NO' not found."

If I start with the later SQL pair first, then it complains that
IBOQuery2: CAT3 can't be found.

IBO V4.3Ab, Firebird 1.5

Any help appreciated,
Thanks,
Steve