Results 1 to 4 of 4
  1. #1
    vad77 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2013
    Location
    USA
    Posts
    105

    Error Handling - Delete Record command button

    Working on an new database and one of my forms is a "Delete Contractor" form. I created a command button as follows.

    Private Sub cmd_DelCont_Click()
    DoCmd.RunCommand acCmdDeleteRecord
    End Sub

    I did not set warnings off because I want to confirm the deletion. The problem I have if I hit No on the confirmation msg box I get a run time error 2501, The RunCommand was canceled.


    How can I eliminate this error?

    Thanks in advance for your assistance.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    vad77 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2013
    Location
    USA
    Posts
    105
    Thank you pbaldy that page was helpful and my error handler works.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 13
    Last Post: 05-06-2014, 12:42 PM
  2. Command Button Error handling
    By Hank153 in forum Reports
    Replies: 2
    Last Post: 10-28-2013, 11:08 AM
  3. Replies: 1
    Last Post: 06-21-2013, 10:41 AM
  4. Error handling for delete record command
    By jobrien4 in forum Access
    Replies: 2
    Last Post: 09-16-2011, 11:00 AM
  5. Command button help - delete record
    By Zukster in forum Forms
    Replies: 0
    Last Post: 08-27-2009, 08:47 AM

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