Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a part number
Message
From
30/01/1997 15:20:45
 
 
To
30/01/1997 15:15:48
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00018858
Message ID:
00018874
Views:
38
>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.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform