Protecting Child / Parent Dependencies
I want to prevent the user from deleting a child record if a parent record exist. What is the best way?
For example, I have:
Part Types Table
On my parts layout, I have a pop up which allows the user to select / define a Part Type (value list from the Part Types Table).
On my Part Types table, I have "add" and "delete" buttons. I don't want the user to be able to delete the Part Type if there is a Part entry that is using that Part Type.
What is the best way to check (in script) if that Part Type has a parent and therefore stop the deletion?
Also, I noticed that if I did delete the Part Type, the popup in the corresponding Parts entry just shows the old ID number from the deleted child record (I'm using ID / auto serial numbers for the relationship).
Thanks in advance for your help.