On 12/09/2010 07:31 PM, MB Software Solutions, LLC wrote:
> On 12/9/2010 7:06 PM, Jeff Johnson wrote:
>
>> I have a combobox where I want the control source value to be displayed
>> in the combobox. If the user wants to change it they can select an item
>> from the drop down. I have never really done this, but what I want to
>> do is to be able to use it like a text box and only use the list feature
>> if they want to.
>>
>> For example, it has "Jeff" in the table and I can type in "Jeffo" and it
>> will save it. Neither Jeff nor Jeffo are in the drop down list which
>> comes from another table.
>>
>
> Sounds like a regular combo dropdown. Here's code in the Valid event of
> one of my combo dropdown classes:
>
> IF EMPTY(This.Value) AND !EMPTY(this.DisplayValue) THEN
> LOCAL lcNewType as String, lnID as Integer, lnOldArea as Integer,
> lcIDDesc as String
> lcNewType = ALLTRIM(this.DisplayValue)
> * The user typed in a new item that isn't on file; see if it should
> be added.
> IF MESSAGEBOX("This " + this.cIDDesc + " is not currently on file.
> Would you like to add " + lcNewType + " to the database? Note: Only "
> + this.cIDDesc + IIF(LOWER(RIGHT(this.cIDDesc,1))="s","es","s") + " that
> are in the database can be used.",4+32+0,"Add new " + this.cIDDesc + "
> to database?") = 6 THEN
> lnOldArea = SELECT()
> lcIDDesc = PROPER(this.cIDDesc)
> DO CASE
> CASE lcIDDesc = "Type"
> lnID =
> thisform.oBiz.AddType(this.cIDType,lcNewType)&& adds new
> type and returns unique id for it
> thisform.GetTypes()&& mjb 08-29-09 was
> thisform.oBiz.GetTypes(this.cIDType)&& will call a REQUERY to get the
> new resulting set (including new record)
> this.Populate()
> CASE lcIDDesc = "Class"
> lnID =
> thisform.oBiz.AddClass(this.cIDType,lcNewType)&& adds new
> class and returns unique id for it
> thisform.GetClasses()&& mjb 08-29-09 was
> thisform.oBiz.GetClasses(this.cIDType)&& will call a REQUERY to get the
> new resulting set (including new record)
> this.Populate()
> OTHERWISE
> MESSAGEBOX("Problem with object. Contact your
> vendor for
> assistance.",16,"Unknown object type (" + lcIDDesc + ")")
> ENDCASE
> this.Value = lcNewType
> this.DisplayValue = lcNewType
> SELECT (lnOldArea)&& restore previous work area
> this.Refresh()
> ENDIF
> ENDIF
>
>
>
Michael: I have used this technique before but what I was actually
looking for was leaving the contents of the control source alone unless
you picked an item from the list. If the item is not in the list, it
blanks out the field. I want to just leave the control source alone if
desired.
Thanks,
Jeff
---------------
Jeff Johnson
[email protected]
(623) 582-0323
www.san-dc.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.