I have a db that has multiple levels of users from supervisors, down to data entry people. On some of the common forms, I would like to lock certain fields from being editted based on the user's security. I've put tags on these fields and am running the following code when the form opens to lock/unlock the fields:
For Each ctl In Screen.ActiveForm
If ctl.Tag = "EngSup" Then
ctl.Visible = True
End If
Next
Is it possible to also control the .Enabled, .SpecialEffect and .Backcolor properties of the control variable CTL like you control the .Visible property? I can't seem to figure it out. I think it SHOULD look like:
For Each ctl In Screen.ActiveForm
If ctl.Tag = "EngSup" Then
ctl.Enabled = True
ctl.SpecialEffect = 2
ctl.BackColor = 16777215
End If
Next
BUT, this doesn't seem to work. Any thoughts? I can make this work by hard coding the object names in my code thereby avoiding the use of Tags and the control vari, but I thought this code was neater.
Thanks!
js
[This message has been edited by jstutz (edited 09-17-2001).]
For Each ctl In Screen.ActiveForm
If ctl.Tag = "EngSup" Then
ctl.Visible = True
End If
Next
Is it possible to also control the .Enabled, .SpecialEffect and .Backcolor properties of the control variable CTL like you control the .Visible property? I can't seem to figure it out. I think it SHOULD look like:
For Each ctl In Screen.ActiveForm
If ctl.Tag = "EngSup" Then
ctl.Enabled = True
ctl.SpecialEffect = 2
ctl.BackColor = 16777215
End If
Next
BUT, this doesn't seem to work. Any thoughts? I can make this work by hard coding the object names in my code thereby avoiding the use of Tags and the control vari, but I thought this code was neater.
Thanks!
js
[This message has been edited by jstutz (edited 09-17-2001).]