>>I am a little bit green in some areas. This is only my 2ed application :-) On the first one is was a geographic location that the user supplied. Any suggestions? thanks for your patients
>
>Try something like this
>
>* Get the next unique key
>LOCAL lcAlias,lnOldRec,lnDernier,lnSelect
>lcAlias=ALIAS()
>lnSelect=SELECT()
>SELECT TABLE
>lnOldRec=SAVEREC()
>SEEK lcAlias ORDER ALIAS
>lnDernier=0
>DO WHILE NOT RLOCK()
>ENDDO
>REPLACE CLE WITH CLE+1
>UNLOCK
>lnDernier=CLE
>RESTREC(lnOldRec)
>SELECT (lnSelect)
>RETURN lnDernier
>
>You may want to create TABLE.DBF, which contains the tables used in your application. At least, one field, CLE, is used to keep the current last unique id.
If the table is part of a DBC you can use a stored procedure for default value of that field. The default value procedure is a function call like GETNEXTID(). The GETNEXTID() function can look like the sample code above. Now anytime a record is appended to this table it will get a new id.
David Lepus