Controls with data not locking or disabled

Steve@trop

Registered User.
Local time
Today, 04:10
Joined
May 10, 2013
Messages
148
I've got some forms that I've set to lock controls based on an added tag. I have a loop that goes through the entire form and disables (controlname.enabled = false) or locks (controlname.locked =true) all the controls with that tag.

This appears to work fine when the form is on a blank record but when an existing record is opened, the controls that have data in them are no longer locked or disabled (empty controls are still locked). Is there an explanation for this behavior? I don't want to disable the entire form because there are controls that I want the user to be able to always access. I started by just disabling them, then when I noticed the problem I tried locking them instead but it happens with both. Is there another property I can try that will really lock them if they have data in them or not?

I'm going to experiment with a fresh table and form just to see if some other programming is causing this but I thought I'd post it to see if anyone else has seen this before.

Thanks,

Steve B.
 
I think I've solved the problem. I think it actually works when using "Locked" instead of disabled. Just to be sure I'm putting BOTH into my loop:

Code:
       Dim ctl As Control
    For Each ctl In Controls
        If ctl.Tag = "ControlGroup" Then
        ctl.Enabled = False
        ctl.Locked = True
        End If
    Next

That seems to keep the control uneditable.

Thanks,

Steve B.
 

Users who are viewing this thread

Back
Top Bottom