Results 1 to 7 of 7

Thread: Cascade Delete

  1. #1
    Join Date
    Jun 2009
    Posts
    23

    Unanswered: Cascade Delete

    Hi,

    I have a form (Form1) and a subform (Form2) bound to tables Table1, Table2 with a delete button. Both form and subform is linked with master/child fields.

    I have selected the fields on form to populate a record from Table1 and When i click on delete button
    1. If there is any record in Table2 that is bound to record of Table1, those gets populated in subform Form2 and the error message "The changes you requested to the table were not successful..." is thrown.
    2. If there is no record in Table2 that is bound to record of Table1, then the record in Table1 is getting deleted without any issues.

    I think the cascade delete is not happening. Can any one of you tell me on how to resolve this issue?. Thanks.

    The below is the code for delete button:
    On Error GoTo Err_btnDel_Click
    DoCmd****nCommand acCmdSelectRecord
    DoCmd****nCommand acCmdDeleteRecord

    Exit_btnDel_Click:
    Exit Sub

    Err_btnDel_Click:
    MsgBox Err.Number
    MsgBox Err.Description
    Resume Exit_btnDel_Click

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Do you have relationships set up between the tables (i.e. nothing to do with the form)?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jun 2009
    Posts
    23
    Yes there is one-many relationship setup between form (Form1) and subform (Form2).

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    And the cascade delete is set up for that relationship?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Jun 2009
    Posts
    23
    Yes, "Cascade delete related records" is selected in Relationship settings.

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    So to be clear:
    If you delete a row from table1 directly, the delete cascades - correct?
    If you delete from table1 via the parent form, the delete fails with that error - correct?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  7. #7
    Join Date
    Jun 2009
    Posts
    23
    If you delete a row from table1 directly, the delete cascades - correct? Yes
    If you delete from table1 via the parent form, the delete fails with that error - correct? Yes

Posting Permissions

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