** create a function or PRG or stored procedure ** called GetNextCustNum() IF !USED("custnum") USE custnum IN 0 ENDIF SELECT custnum lnNextNum = inextnum REPLACE inextnum WITH inextnum+1 RETURN lnNextNum ** create the incrementing table ** this table will stay at 1 record CREATE TABLE custnum ( ; inextnum i) INSERT INTO custnum VALUES (1) ** put it to use ** like as a default in a field in a database table CREATE DATABASE mydata CREATE TABLE custtest ( ; icustnum i PRIMARY KEY DEFAULT GetNextCustNum(), ; ccustname c(30) ) APPEND BLANK && icustnum now = 1 APPEND BLANK && icustnum now = 2 APPEND BLANK && icustnum now = 3 (etc...)Be aware that if you use INSERT INTO custtest FROM MEMVAR to make the default fire, m.icustnum cannot exist.