Results 1 to 4 of 4
  1. #1
    michwh1 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    3

    Cancel an entry and exit form

    What is te best way to handle a situation where someone opens a form to enter data and chooses to cancel this action after entering nothing or has enetred at least some data.



    This is what I have tried so far but errors out because delete action is not available.
    If MsgBox("Are you sure you want to abandon changes to this record?", vbExclamation + vbYesNo, "LogBook 2002") = vbYes Then
    DoCmd.SetWarnings False
    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdDeleteRecord
    DoCmd.SetWarnings True
    Else 'user clicked no
    MsgBox "Deletion was aborted.", vbInformation
    End If
    Last edited by June7; 03-28-2013 at 02:57 PM. Reason: merge posts

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Can try a 'Cancel' button with code:

    Me.Undo

    Review

    http://www.tek-tips.com/viewthread.cfm?qid=822257
    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
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Try:
    Code:
    If MsgBox("Are you sure you want to abandon changes to this record?", vbExclamation + vbYesNo, "LogBook 2002") = vbYes Then
      Me.Undo
    End If
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    michwh1 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    3
    Thanks for the help. That worked. I will also attach in mdb format in the future.

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

Similar Threads

  1. Replies: 2
    Last Post: 12-20-2012, 03:06 PM
  2. Replies: 3
    Last Post: 07-20-2012, 11:41 AM
  3. form exit problem
    By lavi111 in forum Forms
    Replies: 5
    Last Post: 06-23-2012, 07:23 PM
  4. Date And Time Of Member's Entry And Exit.
    By bhavik1978 in forum Access
    Replies: 4
    Last Post: 09-20-2010, 06:40 AM
  5. Replies: 3
    Last Post: 06-04-2010, 12:47 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