Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete gives an error

Status
Not open for further replies.

shaminda

Programmer
Jun 9, 2000
170
US
I have two tables that have one to many relationships (say TableA - 1 and TableB - many). Then I run a join query to view the data(recordset - rst) . When I try to delete a record from this query using rst.Delete statement it gives me the following error,

-2147900, [Microsoft][ODBC SQL Server Driver][SQL Server]DELETE statement conflicted with COLUMN REFERENCE constraint ‘FK_TableB_TableA’. The conflict occurred in database ‘dbBooks’, table ‘TableB’, column ‘UserID’.

Does anybody know how to fix this problem? I tried refresh and requery after the delete statement but didn’t work. But it deletes the data from TableB.
 
Hi,

It means that you have foreign key that refers to the record that you are trying to delete.
Make sure that you have deleted all records that points to the record that you are trying to delete, before you delete the record itself.

Sunaj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top