Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving info not in a dropdown combo box
Message
From
24/10/1999 18:15:12
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00280481
Message ID:
00280680
Views:
15
>>>>>>>I have a combo box on a form that works great. However, I would like it to be able to 'save' info entered that is not in the list.
>>>>>>>I have tried different code , but cannot seem to get it correct.
>>>>>>>can anyone suggest a solution?
>>>>>>>TIA
>>>>>>>DAN
>>>>>>
>>>>>>*** Combo.Lostfocus event
>>>>>>If Not (This.Value==This.Displayvalue) && it indicates that the entry is not part of list
>>>>>>*** insert new record to the table behind the combo
>>>>>>Endif
>>>>>
>>>>>Thanks Ed....
>>>>>
>>>>>Would my code be
>>>>>
>>>>>If Not (This.Value==This.Displayvalue)
>>>>>Append blank
>>>>>Endif
>>>>>
>>>>>??
>>>>>
>>>>>Dan
>>>>
>>>>Nope. It will be like:
>>>>
>>>>If Not (This.Value==This.Displayvalue)
>>>> Insert Into mytable (myfield) values(this.displayvalue)
>>>>Endif
>>>>
>>>>You may also add Combo.Requery if you want added record to be seen in combo immediately.
>>>
>>>Thanks Ed, this code works good.
>>>However , even tho it does add the inputed data to the drop down list,
>>>it still doesnt keep the info in the field , unless one drops down and chooses it...
>>>Is there a way to also keep the added info in the field???
>>
>
>Thanks for your quick reply..
>I tried your latest suggestion, but it doesnt do what i am trying to do...
>1. Keep the inputed value showing in the formfield (the blank combobox field) and...
>2. also add it to the Control Source Table (field)
>
>
>thanks for your immense patience with my ignorance..

Hmm. It seems to me that youy have all pieces already. Try to do it now one step at a time. For example, Insert ... will just add record to the table that is used as combo.rowsource. Replace... will change value in 'controlsource' table (note that it must be different table).
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform