Here is a proceedure I use. You may want only to return the next number in the sequence as Vlad suggested. the code below updates the new record for you
*sample
create table "c:\vfp\temp.dbf" (uid n(9,0), text c(10))
APPEND BLANK
pUniqueID('temp','uid',RECNO())
PROCEDURE pUniqueID (cTable, cField, nRec)
IF nRec < 1 THEN
RETURN
ENDIF
IF TYPE('&cTable..&cField')='U' THEN
RETURN
ENDIF
cTalk = SET('TALK')
cCurrentArea = ALIAS()
SELECT &cTable
SET TALK OFF
CALCULATE MAX(&cField) TO nMax
GO nRec
REPLACE &cField WITH nMax+1
SELECT &cCurrentArea
SET TALK &cTalk
ENDPROC [sig]<p> Pete<br><a href=mailto:blindpete@mail.com>blindpete@mail.com</a><br><a href= > </a><br>What your mother told you is true! You will go blind! (from moonshine anyway)[/sig]