Results 1 to 4 of 4
  1. #1
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727

    Undo New Record IF

    Can someone post the VBA assigned to a click button event:



    If new record is dirty then undo, open form1, and close form2. Else open form1 and close form2.

    Thanks.

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Since you want to 'open form1, and close form2, in either case,' you don’t need an 'else' clause, so

    Code:
    Private Sub YourButtonName_Click()
     
     If Me.NewRecord And Me.Dirty Then
      Me.Undo
     End If
      
     DoCmd.OpenForm "Form1"
     DoCmd.Close acForm, "Form2"
     
    End Sub


    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727
    Thanks so much. This helped me out a lot today. I was able to finish a HUGE chunk of the project. Thanks again.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help!

    Good luck with your project!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 4
    Last Post: 07-30-2013, 02:07 PM
  2. Replies: 3
    Last Post: 11-18-2011, 03:53 PM
  3. Undo problem
    By Waubain in forum Programming
    Replies: 4
    Last Post: 10-27-2011, 12:36 PM
  4. How to undo acCmdPaste ???
    By focosi in forum Programming
    Replies: 12
    Last Post: 09-25-2011, 01:48 PM
  5. Undo one action only
    By zoooza84 in forum Access
    Replies: 5
    Last Post: 08-21-2011, 03:04 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