View Full Version : Delete Query


binksmatthew
03-21-2007, 01:43 PM
is there any way that i can delete records from two different tables using the same delete query as i have them linked in the relationships using Member ID and if i try to delete from one of the tables then and error message appears stating that key violation has occurred.
Thanks

GohDiamond
03-21-2007, 02:38 PM
Cascade Deletion in your relationships table will delete the related subrecords when the main record is deleted. See Tools\Relationships...; double-click on a connecting line for the related tables... you'll be able to edit relationships if you have permissions to do so and the relationship is editable (not greyed out)

For example a MEMBER is related to several monthly Membership payments. When deleting the Member without cascade delete, the error occurs because the payments would then not have a related record if the member is deleted. You could delete any payment though as those are not required. This is a one to many relationship example. 1 member has many payments.

IF referential integrity is established in the relationships and cascade delete is checked then when the member is deleted all his/her payment history/records are deleted as well.

I hope that helps,

Goh

binksmatthew
03-21-2007, 02:54 PM
thanks. it works fine now. i tried just about everythng under the sun except that.