FUNCTION NewID(tcAlias) LOCAL lcAlias, ; lnID, ; lcOldReprocess, ; lnOldArea lnOldArea = SELECT() IF PARAMETERS() < 1 lcAlias = UPPER(ALIAS()) ELSE lcAlias = UPPER(tcAlias) ENDIF lcOldReprocess = SET('REPROCESS') SET REPROCESS TO AUTOMATIC IF !USED("idnums") USE temptest!idnums IN 0 ENDIF SELECT idnums IF SEEK(lcAlias, "idnums", "table") IF RLOCK() lnID = idnums.nextid REPLACE idnums.nextid WITH idnums.nextid + 1 REPLACE updated with datetime() UNLOCK ENDIF ELSE && Table name was not found in idnums table. Create a new record and initialize it to 1 APPEND BLANK REPLACE table WITH lcalias REPLACE nextid WITH 1 REPLACE updated with datetime() lnID = idnums.nextid ENDIF SELECT (lnOldArea) SET REPROCESS TO lcOldReprocess RETURN lnID ENDFUNCIf anyone can give me any insight as to why this is happening or how I can prevent it, I would be really appreciative. Every time this particular routine crashes, I have to do a bunch of record maintenance. This is costing me more time than I would like to spend on it.