Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Basic combobox question
Message
De
08/09/1999 16:21:39
 
 
À
08/09/1999 15:25:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00262558
Message ID:
00262589
Vues:
10
Hi Greg.

>I have a combobox on a form with the control source as table.field . The style is dropdown combobox. I also have items in its list. When I enter a value in the combobox instead of choosing one from the list it doesn't get saved to the table. If I choose a value from the list the item gets saved. Why doesn't the keyed-in item get saved?

Because you have to take some action to add the new value to the combo's RowSource like in the following example. Note, this example assumes a bound column of 2, boundTo = true, RowSourceType = Alias and RowSourceType = ClntType.
This code goes in the combo's valid:


LOCAL lnRetVal
IF This.Value > 0
* Do Nothing
ELSE
IF !EMPTY(This.DisplayValue)
SELECT ClntType
*** Get new PK for the Client type
lnRetVal = GetKey('CLNTTYPE', 'CL_TYPE')
IF (lnRetVal > 0) AND (lnRetVal <= 2147483646)
SELECT ClntType
INSERT INTO ClntType (Cl_Type, TypeDesc) VALUES (lnRetVal, This.DisplayValue)
=TABLEUPDATE()
THIS.Requery()
THIS.Value = lnRetVal
ENDIF
ENDIF
ENDIF
<\pre>

Marcia
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform