Subject | Re: [IBO] IB_LookupCombo + OnChange Event |
---|---|
Author | Ramil |
Post date | 2006-06-26T06:13:58Z |
It was necessary for me same, and I have used AfterScroll event.
Look at the decision of your problem:
procedure TDM.qrCustomerLookupAfterScroll(IB_Dataset: TIB_Dataset);
begin
if qrSales.State in EditSet then
qrSales.FieldByName('SalesMan').AsString :=
qrCustomerLookup.FieldByName('SalesMan').AsString;
end;
Helen rights, speaking about denormalised structure.
Probably it is better to make something like it:
qrCustomerLookup
Fields: ID, Name, SalesMan_ID
qrSales
Fields: ID, Customer_ID, SalesMan_ID
qrSalesMan
Fields: ID, SalesMan
procedure TDM.qrCustomerLookupAfterScroll(IB_Dataset: TIB_Dataset);
begin
if qrSales.State in EditSet then
qrSales.FieldByName('SalesMan_ID').AsString :=
qrCustomerLookup.FieldByName('SalesMan_ID').AsString;
end;
Best Regards,
Ramil
Look at the decision of your problem:
procedure TDM.qrCustomerLookupAfterScroll(IB_Dataset: TIB_Dataset);
begin
if qrSales.State in EditSet then
qrSales.FieldByName('SalesMan').AsString :=
qrCustomerLookup.FieldByName('SalesMan').AsString;
end;
Helen rights, speaking about denormalised structure.
Probably it is better to make something like it:
qrCustomerLookup
Fields: ID, Name, SalesMan_ID
qrSales
Fields: ID, Customer_ID, SalesMan_ID
qrSalesMan
Fields: ID, SalesMan
procedure TDM.qrCustomerLookupAfterScroll(IB_Dataset: TIB_Dataset);
begin
if qrSales.State in EditSet then
qrSales.FieldByName('SalesMan_ID').AsString :=
qrCustomerLookup.FieldByName('SalesMan_ID').AsString;
end;
Best Regards,
Ramil
> Hello,
>
> I'm having problem on using OnChange of IB_LookupCombo.
>
> I have the following scenario:
>
> Form: frmSales
>
> 1 IB_LookupCombo to choose the customer.
> Several IB_Edits like Salesman, payment terms, delivery date, etc...
>
> When I choose any customer, I'd like to fill in the Salesman IB_Edit
> with the value that is stored in Customer Table. I need this, cause
> the salesman that is stored in customer table is just a sugestion.
>
> qrCustomerLookup
> Fields: ID, Name, SalesMan
>
> qrSales
> Fields: ID, Customer_ID, SalesMan
>
> So, in IB_lookupCombo onChange event, I have something like that:
>
> qrSales.FieldByName('SalesMan').asString :=
> qrCustomerLookup.FieldByName('SalesMan').asString;
>
> But, nothing is working, when I click on a customer at IB_LookupCombo,
> the value didn't appear, and SalesMan on Sales table is not filled.
>
> If I comment the code above, the value appear, but SalesMan is not
> filled, of course.
>
> As I verify by debuging, the OnChange is triggerd twice (!?), the
> first one, the cursor on qrCustomerLookup is OK, where I clicked and
> qrSales.Salesman is filled perfect, but the second one, the cursor is
> empty, and then qrSales.Salesman is filled with an empty string.
>
> What I'm doing wrong.
>
> Hope I was clear, my english is too bad...
>
> []s
> Andrei
>
> Win XP Pro + D2006 Pro + FB 1.5.2 + IBO 4.6B
>