* Lostfocus >>This.SetFocus() >>NODEFAULT>
>lparameter tcItem >if type("tcItem") = "U" .or. type("tcItem") = "L" .or. empty(tcitem) > return .f. >endif >local lcAlias, lcField, lnSelect >lcAlias = alltrim(This.cRowSourceAlias) >lcField = alltrim(This.cRowSourceField) >if empty(lcAlias) or empty(lcField) > return .f. >endif >if not used(lcAlias) > use (lcAlias) again in 0 >endif >if not This.mValidateField() > return .f. >endif >lnSelect = select() >_callingrec = RECNO() >select (lcAlias) > >* this will check to see if there is an index tag to see if item exists, and use it >* otherwise a LOCATE will be used. >FOR nCount = 1 TO 254 > IF !EMPTY(TAG(nCount)) && Checks for tags in the index > * ? CDX(nCount) && Display .CDX names > IF UPPER(TAG(nCount)) = UPPER(lcField) > tagexists = .t. > EXIT > ENDIF > ELSE > tagexists = .f. > EXIT && Exit the loop when no more tags are found > ENDIF >ENDFOR >* IF UPPER(TAG(nCount)) = UPPER(lcField) >IF tagexists > SET ORDER TO (lcField) > SEEK ALLTRIM(UPPER(tcItem)) >ELSE > locate for alltrim(upper(lcField)) == alltrim(upper(tcItem)) >ENDIF > > >if eof(lcAlias) > > if this.yesno("Add new record/value to "+alltrim(lcAlias)+"list?") > > APPEND BLANK > replace (lcField) WITH (tcItem) > * insert into (lcAlias) ( (lcField) ) values ( tcItem ) >*!* IF CURSORGETPROP("Buffering")>1 >*!* =tableupdate(.t.) >*!* endif > * browse > if len(ALLTRIM(this.formadd)) > 4 > * SELECT (lcalias) > IF this.formparam = .f. > do form (this.formadd) > ELSE > DO FORM (this.formadd) WITH ALLTRIM(UPPER(tcItem)) > ENDIF > endif > this.Requery() > else > this.setfocus() > endif >endif >select (lnSelect) >GOTO _callingrec >return eof(lcAlias) >>**************************************************************