Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Posts
    21

    Unanswered: Only deletes records from the sub-form

    I have a MS Access database, where, among other tables, there are two in a "master - detail" relationship. I.e., records in the detail table relate to the master table in a many-to-one relationship.

    I have built a form to maintain the master records, and, embedded in that form, is a sub-form to maintain the detail records.

    Everything works great, except for one thing:

    When I try to delete the current record, using the 'x' button in the toolbar, it deletes records from the detail table maintained by the sub-form, but not from the master table maintained by the main form. A natural corollary of this is that when the current record in the master form has no detail records, which happens from time to time, the 'x' button is inoperative.

    What do I need to do to get the 'x' button to delete not the current record from the detail table as displayed in the sub-form, but rather the current record from the master table as displayed in the main form(as well as all of its corresponding records in the detail table)?

    I tried every single possible configuration in the "relationship" view, and that did not help, so the solution apparently does not lie there.

    Thank you.

  2. #2
    Join Date
    Jul 2004
    Posts
    125
    For deletion to work, the relational integrity between the main table and the details table must be set to cascade delete. The focus must be on the main form and not the subform when you delete. If this doesn't work, (toolbar macros are very basic operations and I don't use them), Insert a command button on the main form which activates the delete records action in the main form (in code) and then requery the main form. Requerying will refresh the data.

  3. #3
    Join Date
    Apr 2003
    Posts
    21
    Thank you. That was very helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •