Results 1 to 5 of 5
  1. #1
    nkenney is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Mar 2009
    Posts
    40

    How to I cancel and not save the changed data in a form.


    I have a button which goes from on form1 to form2. The user can modify fields on form2. However if the user makes a mistake, I want to provide ta push button where they can leave form2 and not save their data (a cancel and return button). Is this possible?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Me.UnDo will cancel all changes to a form if done before it is saved.

  3. #3
    nkenney is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Mar 2009
    Posts
    40

    Thanks so much for getting back to me!

    I appricate it.

  4. #4
    nkenney is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Mar 2009
    Posts
    40

    Having troubles getting this to work

    Within my On-Click Code of my close Button I have the following:

    Private Sub Command13_Click()
    On Error GoTo Err_Close_Form_Click
    Me.Undo
    DoCmd.Close

    Exit_Close_Form_Click:
    Exit Sub
    Err_Close_Form_Click:
    MsgBox Err.Description
    Resume Exit_Close_Form_Click

    End Sub

    It saves the data when it closes. I ran it in debug mode and it encountered this data, I just can not get it to not save. Also I know the close command has a parameter to ask for a prompt. That also does not to appear to do anything (I have been playing around with things today). Any info is appricated.

    Thanks,

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I suspect the data has already been saved. See if Me.Dirty is true when you get into the Close Button code.

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

Similar Threads

  1. Replies: 2
    Last Post: 11-25-2013, 10:56 AM
  2. Replies: 9
    Last Post: 03-24-2009, 09:19 PM
  3. Find data, load data, and save as a new record
    By hawzmolly in forum Access
    Replies: 0
    Last Post: 10-05-2008, 03:18 PM
  4. Form requesting to save changes
    By stevo2820 in forum Forms
    Replies: 0
    Last Post: 07-30-2007, 07:41 AM
  5. Save only 3 of 4 fields
    By Schwagr in forum Forms
    Replies: 0
    Last Post: 03-24-2006, 05:20 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