U
Unbridled
I have used Ken Sheridan's code below (Thanks Ken!) to toggle a
subform to keep the information from being edited inadvertantly. The
button is not working on click() and the AllowEdits is not changing
from false to true.
The button, named cmdlock is located on the footer section of a
subform (named Subform1) set up as continuous forms simulated to look
like a datasheet view. The main form is named SPACES. I set up a tab
control on SPACES then placed Subform1 within that.
I appear to be stuck in the current() procedure since the button
caption will not toggle. Any help appreciated.
THIS FUNCTION SETS THE ALLOWEDITS to FALSE AS THE DEFAULT. Placed on
Subform1.
Private Sub Form_Current()
Dim ctrl As Control
Set ctrl = Me.cmdlock
Me.AllowEdits = False
ctrl.Caption = "Click to Edit"
ctrl.Enabled = Not Me.NewRecord
End Sub
THIS WAS ALSO PLACED ON SUBFORM1
Private Sub Form_AfterInsert()
Dim ctrl As Control
Set ctrl = Me.cmdlock
Me.AllowEdits = False
ctrl.Enabled = True
ctrl.Caption = "Click to Edit"
End Sub
HERE IS THE CLICK FUNCTION (placed on the button)
Private Sub cmdlock_Click()
Dim ctrl As Control
Set ctrl = Me.ActiveControl
Me.AllowEdits = True
ctrl.Caption = IIf(Me.AllowEdits, "Click to Lock", "Click to
Edit")
End Sub
subform to keep the information from being edited inadvertantly. The
button is not working on click() and the AllowEdits is not changing
from false to true.
The button, named cmdlock is located on the footer section of a
subform (named Subform1) set up as continuous forms simulated to look
like a datasheet view. The main form is named SPACES. I set up a tab
control on SPACES then placed Subform1 within that.
I appear to be stuck in the current() procedure since the button
caption will not toggle. Any help appreciated.
THIS FUNCTION SETS THE ALLOWEDITS to FALSE AS THE DEFAULT. Placed on
Subform1.
Private Sub Form_Current()
Dim ctrl As Control
Set ctrl = Me.cmdlock
Me.AllowEdits = False
ctrl.Caption = "Click to Edit"
ctrl.Enabled = Not Me.NewRecord
End Sub
THIS WAS ALSO PLACED ON SUBFORM1
Private Sub Form_AfterInsert()
Dim ctrl As Control
Set ctrl = Me.cmdlock
Me.AllowEdits = False
ctrl.Enabled = True
ctrl.Caption = "Click to Edit"
End Sub
HERE IS THE CLICK FUNCTION (placed on the button)
Private Sub cmdlock_Click()
Dim ctrl As Control
Set ctrl = Me.ActiveControl
Me.AllowEdits = True
ctrl.Caption = IIf(Me.AllowEdits, "Click to Lock", "Click to
Edit")
End Sub