Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Basic combobox question
Message
From
08/09/1999 16:21:39
 
 
To
08/09/1999 15:25:42
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00262558
Message ID:
00262589
Views:
11
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
Previous
Reply
Map
View

Click here to load this message in the networking platform