Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Auto ID Field
Message
 
To
21/04/1998 19:22:01
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00093850
Message ID:
00093878
Views:
34
>Does anyone know how to establish a field in Visual FoxPro database which acts as an AutoID? For example when a user enters a new record this particular field will automatically increment. I know how to do this in MS Access, but not in FoxPro. Can Anyone help?
>
>Thanks,
>Bob

Assuming you have 1) a table holding the next Unique ID value for each table and 2) a function that gets the next value from the UniqueID table, you can put this function into the default value of the the ID field for each table. For example, if your function is NewID(MyTable) then in the Customer table, with ID "CUSTID" your default value for the CUSTID field would be NewID('Customer').

Your function can cover checking for duplicate IDs and other problems automatically. This method works even if you are using 'APPEND BLANK' in the command window.

HTH
Barbara Paltiel, Paltiel Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform