Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
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.
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement