lock fields

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
 
G

Guest

Sorry I did not make this clear enough I need to be able to copy multiple items
while in datasheet view, if the record is locked for no changes I get the
error
below. I need to be able to copy these locked records, but not able to
change them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top