Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary Key
Message
 
To
31/12/1998 03:52:28
Jocylyn Sy
Freelance Programmer
Cebu, Philippines
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00171828
Message ID:
00171888
Views:
39
>Happy Holidays Everyone!
>
>I've noticed that although a record has been deleted,
>when you enter the item again, Foxpro still complains
>that the item already exists when item is primarily key.
>
>I was wondering if there is a way to allow the
>re-entry of a primary key item that has deleted.
>
>Thank you.

Jocylyn,

There are tricks you can use but they aren't what I would recommend as they render your PK non-unique. I recommend that you use surrogate PK's, that is a field that has no meaning other than a unique identifier. That way you don't care what the value of the PK is as long as it is unique and you can stop trying to reuse PK values.

I'm sure that someone will tell you about putting a filter on the Primary index for NOT DELETED(), however that solution is only aprtly possible as you can create the filtered Primary index in the table designer but not in program code. Also, the definition of PK is a feild or fields that UNIQUELY identifies a record in a table. With a deleted record in VFP the record is still in the table and it should not have a duplicate PK value of anytoher record in that table.
Previous
Reply
Map
View

Click here to load this message in the networking platform