Enable and Locked (1 Viewer)

CanWest

Registered User.
Local time
Yesterday, 20:15
Joined
Sep 15, 2006
Messages
272
I need to be able to set the Enabled and Locked properties of all fields in a form based on someones security level

I know I can do this

Code:
    If Forms!frm_LogonStorage!SecurityLevel > 51 Then
        Me.FirstName.Enabled = True
        Me.FirstName.Locked = False
    Else
        Me.FirstName.Enabled = False
        Me.FirstName.Locked = True
    End If

The only problem with this is I would have to do this for about 50 fields. Is there a way to do this for the entire detail section of a form. I have searched this forum but have not had any luck
 

bob fitz

AWF VIP
Local time
Today, 03:15
Joined
May 23, 2011
Messages
4,725
You could set some code to loop through all the controls and determine if the control is a text box. Then run you code to set the enabled and locked properties.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 03:15
Joined
Sep 12, 2006
Messages
15,662
Code:
 dim ctl as control
 for each ctl in me.controls
    if whatever then
    end if
 next
 

CJ_London

Super Moderator
Staff member
Local time
Today, 03:15
Joined
Feb 19, 2013
Messages
16,635
if this applies to all the controls on the form, why not just set the forms 'allow edits' property to false
 

CanWest

Registered User.
Local time
Yesterday, 20:15
Joined
Sep 15, 2006
Messages
272
if this applies to all the controls on the form, why not just set the forms 'allow edits' property to false

That would have worked but there were a few controls I did not want have affected.
 

Users who are viewing this thread

Top Bottom