Not a generic one, no. Too many ways in which the programming will need to
do this, and you will need to know *all* the tables and how they relate to
each other so that the programming will do everything that's necessary.
Essentially, what your programming would need to do is one or more of the
following:
(1) when a user wants to delete a parent record, test if there are child
records related to that parent record (there can be *many* child tables),
and to cancel any such deletions. This could be done using DCount function
with a criterion expression based on the parent record's linking fields.
(2) when a user wants to delete a parent record, test if there are child
records related to that parent record (there can be *many* child tables),
and to delete all such child records too. This could be done using a delete
query for each table, with a criterion expression based on the parent
record's linking fields.
(3) when a user wants to change the primary key field's value for a parent
record, test if there are child records related to that parent record (there
can be *many* child tables), and to change the foreign key field's values
for all such child records too. This could be done using an update query for
each table, with a criterion expression based on the parent record's linking
fields.
(4) when a user wants to add a child record using a value for the foreign
key field for which there is no parent record with a matching primary key
field value, cancel the addition. This could be done using DCount function
with a criterion expression based on the value of the foreign key and the
linking field in the parent record.
--
Ken Snell
<MS ACCESS MVP>