locked
Lock single record on subform data sheet when a certain value is entered RRS feed

  • Question

  • Can anyone please help me with this?

    I have a subform that contains a data sheet, when a certain value is entered in a row on the data sheet, I want to lock that record so no changes can be made to any of the values in that row.

    Basically, when the status for an item in the data sheet is set to 'paid' I don't want any of the values on that row to be edited.  

    This is in Access 2013

    Thursday, March 14, 2019 9:16 AM

Answers

  • This is an example of the limitations of using a raw datasheet as a subform's SourceObject.  If you change the source object to a form, which can be in datasheet or continuous forms view, then you can put the following in the form's Current event procedure:

         Me.AllowEdits = (Nz(Me.Status, "") <> "Paid")


    Ken Sheridan, Stafford, England

    • Marked as answer by Yeti_Lee Sunday, March 24, 2019 8:03 AM
    Friday, March 15, 2019 1:00 PM

All replies

  • This is an example of the limitations of using a raw datasheet as a subform's SourceObject.  If you change the source object to a form, which can be in datasheet or continuous forms view, then you can put the following in the form's Current event procedure:

         Me.AllowEdits = (Nz(Me.Status, "") <> "Paid")


    Ken Sheridan, Stafford, England

    • Marked as answer by Yeti_Lee Sunday, March 24, 2019 8:03 AM
    Friday, March 15, 2019 1:00 PM
  • I changed to a form in datasheet view and that works perfectly. Thank you very much. I must apologise for the delay in responding for some reason I did not receive an alert - even though I set the question to alert me.
    Sunday, March 24, 2019 8:06 AM