Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling Primary Key from Form
Message
From
21/02/2003 22:34:53
 
 
To
21/02/2003 13:23:52
Julie Ball
Gardner Publications, Inc.
Cincinnati, Ohio, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00756279
Message ID:
00756498
Views:
17
Was your question answered? It sounds to me like you are asking how to get the name of the field into which to insert the value of the next primary key.

If I understand you correctly, one way you can do it is to pick a field name such as "PK" and use that name as your primary key in all your tables by convention. Then you can even make your INSERT generic - or APPEND BLANK, REPLACE PK WITH NextKey() which will work regardless of the alias name.

If your are looking for a function that returns the name of the primary key expression, there's probably something in DBGetProp, or maybe you can write a loop through all the fields in the table to test for it until you find it.

Another thing you may consider, instead of using one record for each table, if the total number of records in all your tables will be less than 2 billion, is to just have a table with one field (the next meaningless number to use as a unique ID), and one record. E.g., if you add a customer and an inventory item, the customer's ID might be 10003 and the inventory item's ID might be 10004.
Previous
Reply
Map
View

Click here to load this message in the networking platform