The CALCULATE command moves the record pointer to EOF() (it has to, to be sure it has checked all records)
REPLACE has a default scope of NEXT 1 - i.e. it only replaces data in 1 record.
If you are at EOF() there is NO record, so nothing to replace - but this is not an error - it just means that the replace has 'finished'.
The solution is to save the record pointer BEFORE you do the Calculate and restore it afterwards:
lnRec = RECNO()
GO TO (lnRec)
However, this is NOT a good way to generate IDs. The best way is to maintain a separate table which contains, for each table that requires an ID, the table name and the last value. Then write a little function that will locate the correct record, LOCK it, get the next value and then update the table and unlock.
This way you ensure that there can be no collisions when multiple users are accessing the data.