Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Auto ID Field
Message
 
À
21/04/1998 19:22:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00093850
Message ID:
00093878
Vues:
35
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform