I am using the code below to lock fields on a form - user can click a Command Button to unlock and edit.
It works fine except where I have an empty Enabled text fields. I can change data in fields that already have data in them, however those that are empty, appear to be Not Enabled - in that, they won't accept the focus when I click to them.
Does anyone know what the problem is?
Thanks ... Peter
It works fine except where I have an empty Enabled text fields. I can change data in fields that already have data in them, however those that are empty, appear to be Not Enabled - in that, they won't accept the focus when I click to them.
Code:
Private Sub cmdLock_Click()
fLockScreen (Not (Me.lblLocked.Visible)) 'if label visible, screen locked.
End Sub
Private Sub fLockScreen(lswitch As Boolean)
Dim ctl As Control
Me.lblLocked.Visible = lswitch 'Label displays 'locked'
For Each ctl In Me
If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Then
If ctl.Enabled Then ' if enabled then locked the control
ctl.Locked = lswitch
End If
End If
Next ctl
End Sub
Does anyone know what the problem is?
Thanks ... Peter