>>>>>Robert,
>>>>>
>>>>>Are you trying to allow the user to enter a value in the textbox area of the combobox and if what they typed doesn't already exist in the combobox add it to the combobox choices?
>>>>
>>>>Colin,
>>>>yes - I want to treat the combo like a field.
>>>
>>>Robert,
>>>
>>>I've done something similar. The combobox is a list of positions and allows the user to add new values. The code below is in the combobox's .Valid method. The combobox's RowSource is Position.Position and the ControlSource is People.Position.
>>>
>>>IF NOT SEEK(ALLTRIM(THIS.DisplayValue),"POSITION")
>>> mnadd=MESSAGEBOX("Do you wish to add this position type?",4+32+256,;
>>> ALLTRIM(THIS.DisplayValue)+" not found")
>>> IF mnadd=6
>>> INSERT INTO Position (Position) ;
>>> VALUES (THIS.DisplayValue)
>>> REPLACE People.Position WITH THIS.DisplayValue
>>> THISFORM.rtgPageFrame1.Page1.cmbPosition.Requery
>>> THISFORM.rtgPageFrame1.Page1.Refresh
>>> ELSE
>>> THISFORM.rtgPageFrame1.Page1.cmbPosition.DisplayValue=""
>>> THISFORM.rtgPageFrame1.Page1.cmbPosition.Value=""
>>> THISFORM.rtgPageFrame1.Page1.cmbPosition.SetFocus
>>> ENDIF
>>>ENDIF
>>
>>Nice code, but the more common way is check in Combo.Lostfocus
>>IF This.DisplayValue!=This.Value && not any rowsource can be SEEK
>> **** add new record as you did here
>>Endif
>
>I tried this before and it doesn't work. However, your suggestion got me thinking and I came up with a better IF statement. I replaced:
>
>IF NOT SEEK(ALLTRIM(THIS.DisplayValue),"POSITION") with IF THIS.ListIndex=0
>
>Much faster than the SEEK especially as the Position table grows.
thats great Colin, thanks for the news :))))))