>> *------------------------------------------------- >>FUNCTION NextNumber >> * get the next incremental number for the passed field, padded with >> * leading zeros >> >> PARAMETER cField,nLen >> >> cOldAlias = ALIAS() >> lUsed = USED( "System" ) >> IF ! lUsed >> USE SYSTEM IN 0 >> ENDIF >> SELECT SYSTEM >> lDone = .F. >> DO WHILE ! lDone >> IF FLOCK() >> nReturnNum = &cField > >Nothing wrong with this, but try <b>nReturnNum = EVAL(cField)</b> > >> REPLACE &cField WITH &cField + 1 > >and <b>REPLACE (cField) WITH nReturnNum + 1</b> > >It's strictly my allergies to needless macroexpansion. > >> cReturnNum = PADL( nReturnNum, nLen, '0' ) >> UNLOCK >> lDone = .T. >> ELSE >> INKEY(.5) >> ENDIF >> ENDDO >> IF ! EMPTY( cOldAlias ) >> SELECT (cOldAlias) >> ENDIF >> IF ! lUsed >> USE IN SYSTEM >> ENDIF >> RETURN cReturnNum >> >>>>