locked
Access is saving records by itself RRS feed

  • Question

  • I am entering data in a form and as soon as I move to the sub-form field my data is saved. All answers I have read say to use the Undo command but I do not want to clear the fields but rather to allow the user to click the 'Save' button.

    Friday, March 17, 2017 1:12 PM

Answers

  • Hi Marcus,

    If you "must" use your own Save button to actually save the data to your table, then you may have to use an unbound form and do the record saving using code when the user clicks your Save button.

    Just a thought...

    • Proposed as answer by Chenchen Li Monday, March 20, 2017 1:54 AM
    • Marked as answer by MarcusKgosi Monday, March 20, 2017 8:26 AM
    Friday, March 17, 2017 3:24 PM
  • Curious why you need to prevent the parent record from being saved while you are entering child records?

    If you have a scenario such as a purchase requisition (just an example), where you want the order in its entirety to be readily editable, but not committed until final submission, an alternative to unbound forms is to use temp tables for both parent and child records.  The form/subform would be bound to these temp tables, making a staging area for users to enter and edit unsubmitted Purchase Requests.  A "Submit" button would then commit the data to the permanent tables using UPDATE and/or INSERT queries, and remove the data from the Temp/staging tables.  


    Miriam Bizup Access MVP


    • Edited by mbizup MVP Monday, March 20, 2017 10:10 AM
    • Marked as answer by MarcusKgosi Wednesday, March 22, 2017 8:07 AM
    Monday, March 20, 2017 10:10 AM
  • See if the following thread doesn't help.

    https://access-programmers.co.uk/forums/showthread.php?t=229978

    But do keep in mind you are going against MS Access' very basic nature, so don't be surprised if you hit some walls.

    The other option, like theDBguy mentioned is to go the unbound form route, but that is a huge undertaking!  You'd need to code everything Access does by default.  Basically, you'd need to develop your own CRUD functions.


    Daniel Pineault, 2010-2016 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    • Marked as answer by MarcusKgosi Wednesday, March 22, 2017 8:07 AM
    Monday, March 20, 2017 10:34 AM

All replies

  • That is simply not how Access works. Access is not like Excel or Word, it doesn't have a save button, it automatically save changes. It's just the way it works. No point fighting it.

     

    Especially in the case of a sub-form this becomes necessary so the primary key/foreign key relationship can be create/enforced!


    Daniel Pineault, 2010-2016 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net


    Friday, March 17, 2017 3:04 PM
  • Hi Marcus,

    If you "must" use your own Save button to actually save the data to your table, then you may have to use an unbound form and do the record saving using code when the user clicks your Save button.

    Just a thought...

    • Proposed as answer by Chenchen Li Monday, March 20, 2017 1:54 AM
    • Marked as answer by MarcusKgosi Monday, March 20, 2017 8:26 AM
    Friday, March 17, 2017 3:24 PM
  • Hello,

    I suggest you mark helpful post or your workaround as answer to close the thread. And it would be helpful for others who have similar issue. Thanks for your understanding.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 20, 2017 8:03 AM
  • Understood.
    Monday, March 20, 2017 8:27 AM
  • Curious why you need to prevent the parent record from being saved while you are entering child records?

    If you have a scenario such as a purchase requisition (just an example), where you want the order in its entirety to be readily editable, but not committed until final submission, an alternative to unbound forms is to use temp tables for both parent and child records.  The form/subform would be bound to these temp tables, making a staging area for users to enter and edit unsubmitted Purchase Requests.  A "Submit" button would then commit the data to the permanent tables using UPDATE and/or INSERT queries, and remove the data from the Temp/staging tables.  


    Miriam Bizup Access MVP


    • Edited by mbizup MVP Monday, March 20, 2017 10:10 AM
    • Marked as answer by MarcusKgosi Wednesday, March 22, 2017 8:07 AM
    Monday, March 20, 2017 10:10 AM
  • See if the following thread doesn't help.

    https://access-programmers.co.uk/forums/showthread.php?t=229978

    But do keep in mind you are going against MS Access' very basic nature, so don't be surprised if you hit some walls.

    The other option, like theDBguy mentioned is to go the unbound form route, but that is a huge undertaking!  You'd need to code everything Access does by default.  Basically, you'd need to develop your own CRUD functions.


    Daniel Pineault, 2010-2016 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    • Marked as answer by MarcusKgosi Wednesday, March 22, 2017 8:07 AM
    Monday, March 20, 2017 10:34 AM
  • The reason I started this thread was because the macro saving code (that I converted to VBA) was not working. I realized after a while that under my 'Save button' I had DoCmd.Save and not DoCmd.RunCommand acCmdSave.
    Friday, March 31, 2017 6:52 AM