Results 1 to 3 of 3
  1. #1
    pdowg881 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    14

    On Delete Event Not Working

    I have a simple message box code in the On Delete property of my form. It will not trigger when deleting a record from the subform. What should I check that could be causing this.

    Private Sub Form_Delete(Cancel As Integer)
    Cancel = True
    MsgBox "This record can't be deleted."
    End Sub



    Thanks.

    Edit: Confirm Record changes in Access options is checked. I also cannot make the event (or Before/After Delete) fire using the macro builder. They work properly outside of a sub form.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    I use the BeforeDelConfirm event to capture delete action.

    Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
    'suppress default Delete Confirm dialog box.
    Response = acDataErrContinue
    'cancel the automatic delete operation
    Cancel = True
    MsgBox "This record can't be deleted."
    End Sub
    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
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    I have a simple message box code in the On Delete property of my form. It will not trigger when deleting a record from the subform
    Where is the On Delete code - in the main form or the subform? The main form will not detect deletions in the subform.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. PLEASE HELP! Dlookup event not working....
    By emailloni in forum Forms
    Replies: 11
    Last Post: 01-10-2013, 12:43 PM
  2. Replies: 7
    Last Post: 03-15-2011, 11:14 PM
  3. running select query in form delete event
    By suki360 in forum Programming
    Replies: 0
    Last Post: 03-11-2011, 10:11 AM
  4. on delete event in subform
    By suki360 in forum Programming
    Replies: 1
    Last Post: 03-08-2011, 03:45 PM
  5. Not In List event not working
    By Bruce in forum Forms
    Replies: 1
    Last Post: 03-12-2010, 02:24 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