Results 1 to 4 of 4
  1. #1
    xwnoob is offline Advanced Beginner
    Windows Vista Access 2000
    Join Date
    Nov 2011
    Posts
    76

    How to create a save and go to new record button without affecting Me.Undo??

    How do i create a button that saves the current record and moves to a new one? I want to do it in such a way that microsoft access acknowledges the button.



    Below is the following codes in my form:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If Me.Dirty Then
    'Ensure that users do not accidentally save records
    If MsgBox("Do you want to save the updated records?", vbOKCancel, "Save?") = vbCancel Then
    Me.Undo
    End If
    End If
    End Sub
    Private Sub btnUndoIndividualBorrower_Click()
    'clicking on this will undo changes
    Me.Undo
    End Sub

    Private Sub Form_Current()
    ' Disable undo changes button
    Me!btnUndoIndividualBorrower.Enabled = False
    End Sub
    Private Sub Form_Dirty(Cancel As Integer)
    'enable changes button
    Me!btnUndoIndividualBorrower.Enabled = True
    End Sub


    I tried to create save and go to new record using macros and the wizard but im not sure if they even work because everytime i press the button my beforeupdate event appears. How can modify the code such that when i press the button, it saves the record and goes to a new one without displaying my "Do you want to save updates?" message.

  2. #2
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    If your form is bound to a query or table, then the "Save" record to table is automatic once you navagate away from the field. With that said, you should not have to worry about having a code to save the record; just a code to navagate to a new record.

  3. #3
    xwnoob is offline Advanced Beginner
    Windows Vista Access 2000
    Join Date
    Nov 2011
    Posts
    76
    Yes i am trying to do a button to navigate to a new record without activating my message. Can you help me with it?

  4. #4
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Put this code behind your button:
    DoCmd.GoToRecord acDataForm, "YourFormName", acNewRec

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

Similar Threads

  1. do NOT save record on close (x button)
    By benjammin in forum Forms
    Replies: 12
    Last Post: 03-15-2013, 02:54 AM
  2. Button to Create New Record
    By Pam Buckner in forum Access
    Replies: 3
    Last Post: 10-14-2011, 09:46 AM
  3. Create macro save report as PDF
    By bishop in forum Access
    Replies: 3
    Last Post: 09-17-2011, 11:50 AM
  4. Save button say syntax error
    By venu_resoju in forum Forms
    Replies: 6
    Last Post: 02-14-2011, 02:52 AM
  5. Save to PDF Button?
    By SpeedyApocalypse in forum Forms
    Replies: 2
    Last Post: 04-10-2010, 06:06 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