I have this form in my inventory database that shows on a number of datasheet subforms all the info of the computers, peripherals and so on assigned to a workstation. A number of buttons allow the user to remove the selected item from the workstation or add a new one. Every peripheral and component is linked to a workstation through a FK linked to the workstation's PK. There's a Workstation ID'd "stock" where the components get assigned when they're not assigned to any workstation and are ready to use or assign somewhere else.
So, the "Remove from workstation" SQL is pretty simple:
Code:
UPDATE Whatevertablethecomponentisin SET WorkstationID = 'Stock' Where ComponentId=WhateverIdTheSelectedcomponentHas
The selected Id is always the right one because it gets printed on the message to confirm the operation. In fact, it works for every component I have tried except for one. For that particular one it trhows a "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship" error. The only restrictions in the table from that item (in this case the Computers table) is that the ID (which doesn't get changed) must be unique and the Computer name (which gets erased) must be unique too. The name is not the problem since any other computer with a name removed from a workstation is taken out alright. There's no other computer with the same ID on the table (obviously, since the restriction makes it so). But still I get a duplicate error.
I've tried compacting and repairing the DB to no avail. I've removed the component from the DB, created a new one with the same Id (which ironically gives no error), got the same error when removing the component from any workstation I assign it to. But if I go to the computers table I can manually change its workstation FK and remove its name without problem.
I know it's hard to track the error without access to the DB, and I can't share it for this since it's a problem caused by a particular record with 'confidential' data, but has anyone experienced any similar problem and knows what could be causing it?