Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659

    Cascade Delete when Its not set?


    I have a table which has a relationship setup to use a foreign key. Most of the time. when you delete a record from the table, the record comes out clean. No issues. But sometimes, it deletes the foreign key in the foreign key table. I have checked the relationships for the table and I dont see anything marked for cascade delete.

    Thoughts?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Would have to review db.

    Deleting records should be a rare occurrence.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    Yes it is rare that the record is deleted. So the even more rare occurrence of this happening is so hard to catch. The deletion usually occurs to fix an accidental duplicate entry of a record by the user.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Should be a way to catch the duplication before record is committed to table.

    For one thing, users should not work directly with tables and queries.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    I attached a report of the objects used in the databases for this occurence which has occured again. Could you see a problem from it?
    Attached Files Attached Files

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Sorry, that doesn't help me. Don't want to read through 36 pages.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    Well, no. but theres relationship diagrams that cover how they work.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I don't think many readers want to read the full M$oft documentation of your database.
    Perhaps you could describe/summarize the issue showing records before and after,
    And tell us exactly what you think should have happened compared to what you observed.

  9. #9
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    I would have just scrolled to the section concerning the relationships.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Scanned. Doesn't help me understand nor explain the issue. I've never spent much time examining the printed documentation generated by Access. Kills too many trees.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    Yes it is 99% junk IMO. Was just hoping it would help in some light.

    Thank you for your time.

  12. #12
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    I have a Form called Workorders has a datasource of

    SELECT tblWorkOrders.*, tblWorkOrderStatus.SortOrder FROM tblWorkOrders INNER JOIN tblWorkOrderStatus ON tblWorkOrders.Status = tblWorkOrderStatus.id WHERE (((tblWorkOrders.OnOverview)=True) AND ((tblWorkOrderStatus.Status)<>"Non-Prod"));

    I am using it in Datasheet Mode.

    When I choose to Delete(I press the delete key) a record from this Form that runs on the above recordsource. It deletes the Status from tblWorkOrderStatus as well as the record you choose to delete.

  13. #13
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    For one thing, don't use INNER JOIN. You include tblWorkOrderStatus table in RecordSource so can filter on descriptive Status? If you save ID into tblWorkOrders, use ID value for filter parameter, not descriptive Status. Then don't need tblWorkOrderStatus.

    However, INNER JOIN should not cause record to delete from tblWorkOrderStatus.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    I agree with all of your post. I will update accordingly.

  15. #15
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I just set up a test. I had Book2, Author and BookAuthor and added a new book #10 and a new author #8 and did add the record into junction table BookAuthor. I did have referential integrity set up via relationships with Cascade delete set (as I found out). I have attached a jpg of the notification related to the cascade delete.(below) (I cancelled the delete)

    I then closed all tables, adjusted relationship to not set cascade delete. I went through the process to delete Book#10, can not do it because there is a related record in BookAuthor. I then tried to delete the Author #8, same message --the record can not be deleted or changed because table BookAuthor includes related records.
    I then deleted the record in BookAuthor that had Book10 author 8 and it deleted fine, but did not change anything in Book or Author table.

    So with explicit Cascade delete option set, it gave definite warning message.
    Without explicit Cascade delete, it would not allow deletion of records from tables involved in a junction, and did notify that a junction record exists. But it did allow deletion of record from the junction, but did not remove the related book record or author record.

    All that to say I don't know why it did the cascade delete.
    Attached Thumbnails Attached Thumbnails CascadeDelete.jpg  

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Help with cascade combo box
    By jwalther in forum Forms
    Replies: 2
    Last Post: 06-19-2015, 07:19 AM
  2. cascade filtering
    By jscriptor09 in forum Programming
    Replies: 4
    Last Post: 01-10-2014, 12:59 PM
  3. Replies: 1
    Last Post: 11-21-2011, 07:52 PM
  4. Cascade of 3 or more ComboBoxes
    By tomullus in forum Forms
    Replies: 4
    Last Post: 10-08-2011, 06:22 PM
  5. On delete cascade fails in constraint clause
    By Victor EGBE in forum Queries
    Replies: 0
    Last Post: 03-02-2009, 09:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums