G
Guest
I am using the following code to keep user from changing fields if the
checkbox ChkRR has been checked and the tag is set to lock. My problem is
when in datasheet view I get an error that you cannot disable a control while
it has the focus. What can I do to allow changes in datasheet view? Should
this be put on the On_Change event of the checkbox? I need to be able to use
this form in datasheet and form views.
Private Sub Form_Current()
Dim ctl As Control
For Each ctl In Me
If ctl.TAG = "lock" And Me.ChkRR = True Then
ctl.Enabled = False
ElseIf ctl.TAG = "lock" And Me.ChkRR = False Then
ctl.Enabled = True
End If
Next
Me.Refresh
End Sub
checkbox ChkRR has been checked and the tag is set to lock. My problem is
when in datasheet view I get an error that you cannot disable a control while
it has the focus. What can I do to allow changes in datasheet view? Should
this be put on the On_Change event of the checkbox? I need to be able to use
this form in datasheet and form views.
Private Sub Form_Current()
Dim ctl As Control
For Each ctl In Me
If ctl.TAG = "lock" And Me.ChkRR = True Then
ctl.Enabled = False
ElseIf ctl.TAG = "lock" And Me.ChkRR = False Then
ctl.Enabled = True
End If
Next
Me.Refresh
End Sub