Subject Re: [IBO] IBOQuery and TDBLookupComboBox
Author Daniel Rail
At 04/15/2002 08:44 AM, you wrote:
>I have converted an application from BDE to IBO and am having a
>problem with getting the data in a TDBLookupComboBox to track the
>data in the undelying query.
>
>3 IB tables are involved
>SalesItems (SI), Categories (C) and SubCategories (S)
>
>SI contains fields CAT and SUBCAT (and other fields) which are
>populated by selecting values linked to the tables C and S
>
>Table C contains a field CAT (and other fields) and table S contains
>fields CAT and SUBCAT (and other fields).
>
>There are 2 IBOQueries
>SELECT CAT FROM CATEGORIES
>and
>SELECT CAT, SUBCAT FROM SUBCATEGORIES WHERE CAT = :CAT
>This query is linked to the first query by a TDataSource component.
>
>Both queries are selecting the correct information.
>When moving through the a query based on SI, the values of SI.CAT and
>SI.SUBCAT change. When SI.CAT changes, the TDBLookupComboBox linked
>to the SI.CAT field updates correctly but the TDBLookupComboBox
>linked to the SI.SUBCAT does not even though the correct values are
>fetched by the query.
>Sometimes the value displayed is correct but at other times (more
>commonly) the value displayed is blank. It is even possible to scroll
>forward through a record and the value to display correctly and the
>scroll back from the following record and the value to display as a
>blank.
>
>I placed an IB_Monitor component on the offending form and obtained
>the following output when scrolling from one record to the next. It
>is clear from this that the problem has been caused by the order of
>the SQL statements. The change in SI cause a change in SI.CAT
>from 'ZINTEC O/S' to 'ALUMINISED' and a change in SI.SUBCAT from NULL
>to 'AS04'. However the subcategories table is queried to locate the
>SUBCAT before the subcategories IBOQuery is updated, resulting in the
>error. In the BDE version of this program there is no such problem!
>Can you help me?

You are right. I tried this kind of setup and found it working half the time.

Here's what I tried:
Instead of using the DataSource property to link SubCategory to
Category. Try using the OnAfterScroll event of Category to refresh
SubCategory with the proper parameter value.

Give that a try and let me know.

I personally don't use TDBLookupComboBox from Delphi, I use the one from
Infopower instead, and it's not setup the same way. But, that doesn't mean
that I wouldn't help any further if you still need help.

By the way, I saw your post on IBDI. I just didn't have the time in the
past few days to setup an application to look at your problem and
understand it fully.

Have a nice day.


Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.accramed.ca)