Preka
Programmer
- May 11, 2004
- 55
So, this is driving me up a wall. This is a SQL Server 2005 database using Access via ODBC as a front end for some very simple data entry forms for an extremely short term project of limited scope.
The relevant tables (or, really, an abstraction of them) are:
TblRelations:
RelID (PK, autonumber)
CompanyID(FK)
ParentID(FK)
TblCompany:
CompanyID (PK, autonumber)
(misc irrelevant fields, address, etc.)
TblParent:
ParentID(PK,autonumber)
(misc. irrelevant)
Every company should only be associated with a single parent, so a unique key index was created on the CompanyID field in tblRelations. Once that index is defined, however, deleting a record from tblRelations causes the parent record in tblCompany to also be deleted, but only when the deletion is performed from the Access. If I simply open the table in SQL Studio and delete the records from the table, it behaves exactly as I would expect - the record is deleted from tblRelations and the associated record on tblCompany is left intact.
What am I missing here?
The relevant tables (or, really, an abstraction of them) are:
TblRelations:
RelID (PK, autonumber)
CompanyID(FK)
ParentID(FK)
TblCompany:
CompanyID (PK, autonumber)
(misc irrelevant fields, address, etc.)
TblParent:
ParentID(PK,autonumber)
(misc. irrelevant)
Every company should only be associated with a single parent, so a unique key index was created on the CompanyID field in tblRelations. Once that index is defined, however, deleting a record from tblRelations causes the parent record in tblCompany to also be deleted, but only when the deletion is performed from the Access. If I simply open the table in SQL Studio and delete the records from the table, it behaves exactly as I would expect - the record is deleted from tblRelations and the associated record on tblCompany is left intact.
What am I missing here?