Becks said:
Thanks for the help Dirk.
It does sound like that is what is going on with our database. Is
there a way for us to determine if the relationship was defined with
'cascading deletes'? Is it as simple to tell as just going into the
database and looking in the relationships section?
That's basically right. Open the Relationships window, make sure that
the tables in question are displayed in the diagram, and see if ...
(a) there's no join line between the tables, connecting the key fields
that are related. No join line = no relationship defined at all.
(b) if there's a join line, double-click it (be careful to double-click
right on the line, not just near it). That should display the Edit
Relationships dialog for those two tables. If the check box "Enforce
Referential Integrity" isn't checked, then the relationship is not
enforced, so cascading deletes aren't in effect.
(c) if "Enforce Referential Integrity" is checked, but "Cascade Delete
Related Records" is not, then cascading deletes are not in effect, but
the database won't let you delete a parent record that has any child
records in the related table. I don't think that can be the case here,
though.
So I would
imagine that if the database wasn't set up this way there isn't
really a way for us to delete out the records which are no longer
valid in the system.
Sure there is, but you have to set up a query to do it. First, use the
Find Unmatched Query Wizard (Insert -> Query -> Find Unmatched Query
Wizard) to create a query that shows all records in the child table (the
"many side" table) that have no match in the parent table (the "one
side" table). When you've got that query created and can see the
results -- and confirm that you want to delete them -- you can either
just select them all and delete them, or else go back into design view
for the query and change its type from Select Query to Delete Query, and
then run it.
Maybe we should create something to help filter
them out at least. Thanks again for all the help.
That would be another alternative. I can't really advise about that, as
I don't know all the details of your database.