Subject | TIB_LookupCombo to display Name but save the ID |
---|---|
Author | Bob |
Post date | 2002-04-29T18:44:26Z |
I have a LookupCombo in a contract form to lookup a Customer ID. It works
fine that way. But instead of looking up Customer ID, I'd like to allow the
user to lookup by CustomerName, and still store the Customer ID in the
Contract table.
qrCust looks like this:
SQL : SELECT CUST_ID, NAME FROM CUSTOMER
Keylinks : CUSTOMER.CUST_ID=CONTRACT.CUST_ID
KeySource : dsContract
the LookupCombo is set with
CustomPopup : grCust
DataSource : dsCust
DisplayField : NAME
It works *almost*. When the user enters the form, they see the Customer Name
in the LookupCombo. But when the user types in there, we are actually
searching on the Customer ID field (instead of the Customer Name). When the
user leaves the LookupCombo, it correctly displays the customer name. For
example, if customer "Fred's Company" has user ID "COFRED", the user cannot
type "Fred" to find him, they must type "COF"... even though the lookupcombo
will display "Fred's Company" when they leave it. It's confusing.
Ideally I'd like to have a field where the users can start typing the name
of a customer, and while they are doing that the control will drop down with
all matching customers so far. The user could then either finish typing the
name, or select (in the dropdown) the desired customer. When they're done,
the customer ID is stored.
Make sense? Thanks for any advice.
Bob.
fine that way. But instead of looking up Customer ID, I'd like to allow the
user to lookup by CustomerName, and still store the Customer ID in the
Contract table.
qrCust looks like this:
SQL : SELECT CUST_ID, NAME FROM CUSTOMER
Keylinks : CUSTOMER.CUST_ID=CONTRACT.CUST_ID
KeySource : dsContract
the LookupCombo is set with
CustomPopup : grCust
DataSource : dsCust
DisplayField : NAME
It works *almost*. When the user enters the form, they see the Customer Name
in the LookupCombo. But when the user types in there, we are actually
searching on the Customer ID field (instead of the Customer Name). When the
user leaves the LookupCombo, it correctly displays the customer name. For
example, if customer "Fred's Company" has user ID "COFRED", the user cannot
type "Fred" to find him, they must type "COF"... even though the lookupcombo
will display "Fred's Company" when they leave it. It's confusing.
Ideally I'd like to have a field where the users can start typing the name
of a customer, and while they are doing that the control will drop down with
all matching customers so far. The user could then either finish typing the
name, or select (in the dropdown) the desired customer. When they're done,
the customer ID is stored.
Make sense? Thanks for any advice.
Bob.