Results 1 to 3 of 3
  1. #1
    dave_282 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2016
    Posts
    8

    Form Buttons

    Hello All,
    Hope all is well. I have a form I'm using for MS access to enter data into a table. All is working well but I've got some buttons on the form that aren't working as I want them too. What Id like to achieve is a save button which when pressed confirms the save which Ive currently got working with some VBA and then I'd like the users to be able to change the odd one or two fields and then hit save again and a new record be entered into the the table, but that isn't working, I also have a clear button and I've noticed that nothing actually saves into the table until after the clear button is pressed, which means total re-entering of every field.

    As I say I have a save button, which has the VBA:
    Code:
    Private Sub Save_Record_Click()
       Dim strMsg As String
       Dim iResponse As Integer
       ' Specify the message to display.
       strMsg = "Do you wish to save the changes?" & Chr(10)
       strMsg = strMsg & "Click Yes to Save or No to Discard changes."
       ' Display the message box.
       iResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?")
       
       ' Check the user's response.
       If iResponse = vbNo Then
       
          ' Undo the change.
          DoCmd.RunCommand acCmdUndo
          ' Cancel the update.
          Cancel = True
       End If
    End Sub
    and then a clear button which the "refresh form data" set from the wizard. Can anyone advise on what buttons I need in order to achieve what I want please?


  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    I don't see the need for this. Access saves automatically. No need for any code.
    If you save wrong, just change it.

  3. #3
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    agree with ranman, as long as this is a form linked to the table and not unbound then the next or previous buttons save the data. if you are wanting to limit the users ability to enter or change a record that's another thing.

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

Similar Threads

  1. Replies: 1
    Last Post: 08-15-2013, 08:12 PM
  2. Replies: 10
    Last Post: 09-18-2012, 02:00 PM
  3. Form Buttons
    By DCV0204 in forum Forms
    Replies: 9
    Last Post: 11-30-2011, 02:34 PM
  4. GO TO buttons on form
    By csh in forum Forms
    Replies: 8
    Last Post: 10-23-2011, 06:40 AM
  5. Form and Buttons
    By rmohebian in forum Forms
    Replies: 1
    Last Post: 02-14-2011, 09:57 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