"Tara" <(E-Mail Removed)> wrote in message
news:E409FA4A-5E16-46B0-867E-(E-Mail Removed)...
> Dirk, sorry it took me so long to get back with you on this.
>
> The relationship between tblContacts and tblAmendedDates is basically
> parent/child. TblAmendedDates is used to add and/or alter the existing
> data
> in the tblContacts parent record to which it is attached.
>
> The relationship is set up as a one-to-many due to the (highly unlikely)
> chance that he user amends a record and for some reason, at a later date,
> needs to amend the amendment...if that makes sense. I highly doubt it
> will
> ever happen, but better to be prepared for the possibility I guess.
>
> If a user deletes the "parent" record so-to-speak in tblContacts, I want
> any
> and all associated records in tblAmendedDates to be deleted as well.
With Cascade Deletes enforced, that would work -- *IF* you were deleting the
parent record from tblContacts. But, as I explained in my earlier post,
that's not what you are doing. Because your form is based on a query that
joins the two tables, when you delete from the form, only the record from
tblAmendedDates is being deleted.
If your form were in single form view, you could base it on tblContacts
alone, and use a subform to show the amended-dates. Then a simple delete
from the main form would work. But you can't do that in continuous forms
view.
Probably the easiest way to solve this problem is to set the form's Allow
Deletions property to No, but put a command button on the form to delete the
record. The code for that command button would execute a delete query to
delete the current record directly from tblContacts -- relying on the
relationship with Cascade Deletes to delete the records from
tblAmendedDates, and then requery the form.
Is that something you can figure out how to do by yourself, or do you need
help with the code?
--
Dirk Goldgar, MS Access MVP
Access tips:
www.datagnostics.com/tips.html
(please reply to the newsgroup)