I'm used to check the ref. integrity checkbox when making relations, but
not the checkboxes below that setting. So people have to manually delete
the "many"-records, before they can delete the main record. I noticed in
an inherited mdb that all 3 ref. integrity check boxes are checked. Is
this common practice and is it recommended? Or can I run into problems
with that?
It is a fairly common practice, and I think it's recommended on a case by
case basis. For example if you have some type of purchase order system or
even an invoice system in which the invoice can and will be deleted, then
you want the child reocreds (the invoice details reocreds) to all be
automatic deleted also.
You might have a simple database to keep track of your friends and their
favorite foods. So the favorite foods table would be a table that's related
back to table friends. When you remove or delete friends, you want all the
records that represent their favor foods to also be deleted.
And, I suppose you also want that you can't add a favorite foods record
unless you first had a friend's record.
So don't confuse a situation where you have a list of child records that
represents repeating types of information (such as favorite foods). You also
might have in this database an 3rd table that is a list of legitimate
"allowable" foods that you use to drive a combo box for the farvoate foods
table. In this case if you want a delete a food that's not being used very
much, if one of the records in that the favorite foods is still using a
particular food type, then you can NOT delete the food record yet can you?
So there's two types of relationships you're talking about here. One in
which you have a table that's usually used to drive a combo box and this
make things easier for the for user to select a value form that list
(perhaps a color, or as mentioned a type of food). When you delete a master
friend record (often called the parent record), those food reocrds are not
touched nor are they to be deleted. So delete one of your friends from the
database, the list of available foods to choose for the favorite food list
table will not be changed.
So the list of records in the table that represents the persons favorite
foods most certainly needs to be deleted when the person is deleted (so, you
choose cascade delete).
However, the table of available foods will remain untouched, and no new
records are added, nor deleted when you add new friends or even update the
list of favorate foods that a particular friend has.
So, we have 3 tables:
tblFriends---->tblFavorateFoods----->tblFoods
So in the above we want all records in tblFavorateFoods removed when you
delete a friend reocrd. However, the tblFoods table is rarely changed, and
no reocrds are added, nor to be deleted when you delete a friend.