What I am trying to accomplish is this:
When a user creates a new invoice on frminvoice, then enters the order
details in the frminvoicedetails, but then wants to delete the invoice. I
added a delete command button but it only deletes the record associated with
the main form.
How do I delete the information within the subform that is assocated with
that particular invoiceid that has been deleted?
Any suggestions?
Thanks,
Brook
Rick B - 28 Apr 2005 16:08 GMT
One way is to turn on cascading deletes in your relationship window. When
on, any time you delete a main record, all the associated records would be
deleted.

Signature
Rick B
> What I am trying to accomplish is this:
>
[quoted text clipped - 11 lines]
>
> Brook
Brook - 28 Apr 2005 16:38 GMT
Thank you...
That worked great..
Brook
> One way is to turn on cascading deletes in your relationship window. When
> on, any time you delete a main record, all the associated records would be
[quoted text clipped - 16 lines]
> >
> > Brook
Van T. Dinh - 28 Apr 2005 16:18 GMT
You can set Referential Integrity with Cascade Delete Related Records and
the related Child Records will be deleted automatically when the Parent
Record is deleted. However, this is rather dangerous as it is too easy to
delete Child Records in you accidentally delete the Parent Record.
The other way is to use code to run a Delete Query / SQL String to delete
the related Child Records first before deleting the Parent Record.
Check Access VB Help on RunSQL or OpenQuery Method.

Signature
HTH
Van T. Dinh
MVP (Access)
> What I am trying to accomplish is this:
>
[quoted text clipped - 11 lines]
>
> Brook