> I posted this question a couple of days ago and got 1 response but
> couldn't read it. Hopefully someone will have and answer.
Mark, here's the answer I posted to your question.
Hopefully it comes through as readable this time.
Previous reply:
==========
When you enter the main form record, and move into the subform to enter the
line items, the header record saves into its table. Consequently you can't
just "undo" the record and whatever line items you have entered in the
subform.
Perhaps you could add a Delete button to the main form, and use cascading
deletes to delete the line items in the subform as well:
1. Open the Relationships window (Tools menu, or Database tab of the ribbon
in A2007). Create a relationship between tblInvoice.InvoiceID (the primary
key) and tblInvoiceDetail.InvoiceID (the foreigh key), and check the boxes
for:
[ ] Referential Integrity
[ ] Cascading Deletes
2. Open your main form in design view, and add a command button with these
properties:
Name cmdDelete
Caption Delete this invoice
On Click [Event procedure]
3. Click the Build button (...) beside the On Click property.
Access opens the code window.
Set up the code so it looks like this:
Private Sub cmdDelete_Click()
If Me.Dirty Then
Me.Undo
End If
If Not Me.NewRecord Then
RunCommand acCmdDeleteRecord
End If
End Sub
Clicking the button will now delete the invoice, and the cascading delete
will delete any line items in that invoice.

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
mthornblad@gmail.com - 19 Nov 2007 05:14 GMT
> <mthornb...@gmail.com> wrote in message
>
[quoted text clipped - 49 lines]
> Tips for Access users -http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
Allen
Thank you very much for your help. I did what you said and it worked
perfectly.
I hope everything is good "down under". You are a lifesaver !
Mark