Danyd,
You reference it just like a field, memory variable or function like date():
?recno() displays the record number
if custid = recno()
do stuff
endif
replace custid with recno()
But, as Aiden suggested, it's better to roll your own. It has the advantage of being able to use any starting number you want. Also, for recno to be a truly incrementing and unique number, you can NEVER, EVER sort or pack your table (and no one else should either - but there's nothing to stop someone).
Like Aiden suggests, create a new table, CustID, with 1 field: CustID, Numeric, 10.0. Add 1 record to it with the starting customer ID number, e.g. 1001. In your program, when you are ready to add a new customer (this is different code than Aiden's but both work):
Use Customer && or whatever the table name is.
Use CustID in 2
append blank
Replace CustID with CUSTID->CustID + 1;
CUSTID->CustID with CustID + 1
Note: The manual says don't replace in another work area. This method works fine as long as the replaced field isn't in an index, as above.
Mike.
- There are an infinite number of ways to dBase your programming...