Subject Re: Problem with event OnChange -> IB_LookupCombo
Author Andrei Luis
Hi Helen, thanks for your help, the problem was solved... Answers are
below.

--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> Andrei,
>
> At 11:29 AM 30/06/2005 -0300, you wrote:
> >I'm trying to use this code on OnChange event of IB_LookupCombo:
> >
> >dm.qrSalesItems.FieldByName('Price').AsCurrency :=
> >dmLookup.qrProductSales.FieldByName('Sale_Price').asCurrency;
> >
> >This IB_LookupCombo points to dmLookup.qrProductSales.
> >
> >The problem is: when I'm insert data in dm.qrSalesItems, and click
> >IB_LookupCombo, the record are shown, but, I can't choose any!
> >
> >If I put the code on OnExit event of the same IB_LookupCombo, I can
> >choose normally a product.
> >
> >Can't I use that code on OnChange event?
>
> No. The dataset and its relationships drive the controls, not the
other
> way around.

I'm still thinking like I used to do with Paradox, this just works
fine.

> The ib_lookupcombo is designed specifically for matching a
> unique lookup item with a non-unique value in the Keysource
dataset. (The
> Keysource dataset is the one that wants to get a value from the
lookup).
>
> The information you provide isn't adequate to tell what is wrong
here, but
> the minimum elements should be:
>
> 1) the lookup dataset's KeySource property must point to the
datasource of
> the SalesItems set.

That's OK.


> 2) the values in the lookup list must be unique and not null.

That's OK.

> 3) the field name of the unique value should occupy the left side
of the
> KeyLinks property, while the right side should contain the set-
qualified
> name of the Sales Details field that is to be linked to the lookup
value:
> i.e. Sale_Price=qrSalesItems.Price
>
> If there are two members in the KeyLinks then they both must be
present, e.g.
> Sale_Price=qrSalesItems.Price
> Product_ID=qrSalesItems.Product_ID

This solved the problem. I added the line
Sale_Price=qrSalesItems.Price and 'shazam', now I have the sale_price
when I choose any product.


> 4) Mastersource, MasterLinks, etc. must not be enabled between
these two sets

That's OK