>>> *------------------------------------------------- >>>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 >>> REPLACE &cField WITH &cField + 1 >>> 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 >>> >>>>>>
* Stations.dbf *Netbios_name c(30) - indexed with tagname stationid function GenerateKey if !used("Stations") use stations in 0 endif if !seek(sys(0), "stations","stationid") insert into stations (Netbios_name) values (sys(0)) endif lcRetVal = bintoc(recno("stations")-128,1)+substr(sys(2015),2) return lcRetValBTW VPM doesn't set buffering on for tables by default (but it sets buffering to 2 at form level).