We have an ORDERS table and a CHARGES table. For each order there may be a charge. If the order is deleted we want the charge to automatically be deleted.
If there would be a single relationship between the two tables, we could define the relationship to cascade delete the charge when the order is deleted.
Unfortunately, the tables are related using two fields.
How would one do this using a data macro?
Inspired by Delete Records from Table Before Delete Trigger I tried the following:
where DeleteCharge
is a VBA
function
It works, but:
- I would prefer not to have to use VBA
- If the user cancels the first deletion, the triggered deletion still gets carried out.