I prevent editing of the records in the form to prevent accidental changes to the record. I do this in form current event I set Me.AllowEdits = False.
I have a button to allow edits. When the click the button I set Me.AllowEdits = True. However, users still cannot edit the record.
Is the Form Current event the wrong event to disable editing? Should I use a different event for that?
This works for me in a regular single & continuous form.
The Edit button must be inside the form, so it doesn't trigger the Current event when going from button to form controls.
' Allow editing
Private Sub cmdEdit_Click()
Me.AllowEdits = True
End Sub
' Revert to not allow editing...
' ... after the current record has been saved
Private Sub Form_AfterUpdate()
Me.AllowEdits = False
End Sub
' ... and after changing record (if user clicked Edit on another record, but didn't edit anything)
Private Sub Form_Current()
Me.AllowEdits = False
End Sub