none
Disable the Save button when there is no changes in a record RRS feed

  • Question

  • I have several forms that have buttons for Save,Edit, Next record and etc. How can I disable the Save button after the operator save the form and don't let him/her to click it when there is no changes in the form. Sometimes pressing it unintentionally make problems.


    Karim Vaziri Regards,

    Tuesday, July 19, 2016 5:47 AM

Answers

  • Take a look at SaveDemo.zip in my public databases folder at:

    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169

    Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to amend the form design accordingly.  

    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.

    This little demo file illustrates exactly what you are attempting.  However, it would be more accurate to say that it detects an 'update' of the form rather than a 'change', i.e. it detects if the data has been edited even if the user has then changed it back to its original values other than by undoing the edit.  To detect actual changes to the data the ChangedRecordDemo file in the same OneDrive folder illustrates the use of a module which does this.

    Ken Sheridan, Stafford, England

    • Proposed as answer by Stefan Hoffmann Tuesday, July 19, 2016 11:21 AM
    • Marked as answer by kvaziri Tuesday, July 19, 2016 9:37 PM
    Tuesday, July 19, 2016 11:15 AM

All replies

  • I have several forms that have buttons for Save,Edit, Next record and etc. How can I disable the Save button after the operator save the form and don't let him/her to click it when there is no changes in the form. Sometimes pressing it unintentionally make problems

    Hi Karim,

    The problem with disabling the Save button after saving, is that it must be enabled again after a change. That is a little more complex to program.

    But what you could do is check the form's property Dirty on pressing the Save button. If Dirty = False, nothing has been changed, so you can bypass the save action.

    Imb.

    Tuesday, July 19, 2016 6:59 AM
  • Take a look at SaveDemo.zip in my public databases folder at:

    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169

    Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to amend the form design accordingly.  

    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.

    This little demo file illustrates exactly what you are attempting.  However, it would be more accurate to say that it detects an 'update' of the form rather than a 'change', i.e. it detects if the data has been edited even if the user has then changed it back to its original values other than by undoing the edit.  To detect actual changes to the data the ChangedRecordDemo file in the same OneDrive folder illustrates the use of a module which does this.

    Ken Sheridan, Stafford, England

    • Proposed as answer by Stefan Hoffmann Tuesday, July 19, 2016 11:21 AM
    • Marked as answer by kvaziri Tuesday, July 19, 2016 9:37 PM
    Tuesday, July 19, 2016 11:15 AM