General information
Category:
Forms & Form designer
Title:
Adding to a combo box
I have a combo box field that is initially pouplated through an sql statement. If one of the choices is not what the user wants, I wanted the user to be able to enter a new value. This is what I have in the valid event of the combo box.
IF !EMPTY(this.text)
FOR i=1 TO this.ListCount
IF this.List(i)=this.text
RETURN
ENDIF
ENDFOR
THIS.AddItem (THIS.text)
cAlias = LEFTC(THIS.controlSource,(ATC(".",THIS.controlSource)-1))
cColumn = RIGHTC(THIS.controlSource,(LENC(THIS.controlSource)-ATC(".",THIS.controlSource)))
THIS.rowSourceType = 3
cSQL = "SELECT DISTINCT " + cColumn + " FROM " + cAlias + ;
" INTO CURSOR c" + THIS.name
THIS.rowSource = cSQL
ENDIF
After this fires the combo box is left empty and the new value is not among the listed items. What am I missing ?? This seemed pretty straight forward.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only