How to delete a record in a subform

L

lushh

hi guys. i currently have a form and a subform. the form includes the
employees' information while the subform contains their contract dates.
whenever i want to delete a record of an employee and click the delete button,
it won't allow me to and a "The record cannot be deleted or changed because
table 'tblContract' includes related records." message appears.

here's how the form looks like:

http://i114.photobucket.com/albums/n258/lushh_16/subformemployee.jpg

how can i delete both records in the form and subform just by clicking the
delete button. thanks a lot...
 
A

Allen Browne

Open the Relationships window (View menu.)

Create (or edit if you have already created) a relation between tblEmployee
and tblContract, based on the common field (probably called EmployeeID.)
Check the boxes for Referential Integrity, and for Cascading Delete.

Now when you delete an employee, all their contracts are deleted as well.
 
A

Al Campagna

lushh,
In Tools/Realtionships create your link between the 2 tables. Select Referential
Integrity, and also check the Cascade options.
The Cascade Deletes will cause all subform records to delete when the main record is
deleted.
 
L

lushh via AccessMonster.com

hi.. thanks a lot for your replies. it did work.. thank you guys... i really
appreciate it... =) good day...
 
Top