Hi Kimberley
This is a bit rough and done from the top of my head, but here's a little program to demonstrate how a unique number might be generated. Please see if this works for you and look for differences in your technique. You'll need a NEWIDTABLE that is something like this...
CREATE CURSOR NEWIDTABLE (TABLENAME C(40), LASTID I)
APPEND BLANK
REPLACE TABLENAME WITH "THISTABLE",LASTID WITH 0 IN NEWIDTABLE
*Here's how to call it.
luNewKey = GETNEWID("THISTABLE")
IF VARETYPE(luNewKey)="L"
RETURN .F.
ENDIF
APPEND BLANK
REPLACE uniquefield WITH m.liNewKey IN THISTABLE
RETURN .T.
GETNEWID.PRG
LPARAMETERS tcTable
IF NOT USED("NEWIDTABLE")
USE NEWIDTABLE IN 0
ENDIF
IF NOT SEEK(m.tcTable,"NEWIDTABLE","TABLETAGNAME")
RETURN .F.
ENDIF
IF NOT LOCK("NEWIDTABLE",RECNO("NEWIDTABLE"))
RETURN .F.
ENDIF
LOCAL liNewID
REPLACE LASTID WITH NEWIDTABLE.LASTID + 1 IN NEWIDTABLE
liNewID = NEWIDTABLE.LASTID
UNLOCK RECNO("NEWIDTABLE") IN NEWIDTABLE
RETURN m.liNewID
>Hi, I just stumbled on a fix (though I don't like it).
>
>I put another record in the counters table (and left it blank), and in my code I do this:
>
>SELECT tblCounters
>LOCATE
>skip
>skip -1
>
>before assigning the value to the form object and replacing the table value with the table value + 1.
>
>This can't be the right way to do this, do either of you have any ideas?
>
>Kimberley (sob, sob)