I am blocking users from accidentally editing datasets. They have to hit a button to edit stuff. This button sets the "AllowEdits" setting of the form to "true" which is "false" by default. It also changes the caption of the button accordingly.
My problem is: the button does not bring back the lock, when I hit it a second time. Of course I have the same code reversed for this case.
What am I missing?
Private Sub toggleEdit_Click()
If Me.AllowEdits = True Then
Me.AllowEdits = False
Me.toggleEdit.Caption = "Unlock"
Else
Me.AllowEdits = True
Me.toggleEdit.Caption = "Lock"
End If
End Sub