lnNextid = 0 LOCATE FOR id.tablename = lcTable IF !EOF() if RLOCK() lnNextid = id.keyvalue replace id.keyvalue with lnnextid + 1 endif endif return lnNextidThe problem is in ASP.NET with ODBC connection we have no way of locking the record (that i know of) to make sure two users do not happen to similtaneously call our newid function and receive a duplicate key.