I am trying to build a code where previous records in a certain form are locked for editing. This would be to allow users to create and edit new forms, but not change data from previous forms. I want to be able to allow users to access and edit the previous 5 forms, but lock the data in all forms previous to that.
I've tried several things, but as a novice VBA user, nothing has worked. I tried:
Private Sub Form_Load()
If Me.ID < 22 Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub
I used a dummy "22" to see if the code would work, but it just ended up locking all of the records, not just numbers 1-21, like I was trying to do.
I would like the "22" to be the value of the ID field in the most recent record. I would also like it to be: If Me.ID < (ID of most current record)-5
Is this possible?