Good Morning Everyone,
My form has 21 controls on it. I’m currently using a lenghy Select Case to control the properties of each control. Each time a control is added/removed, I need to modify the Select Case Statement w/6 Cases.
To simplify things, I thought it would more functional and less work if this code were in a module, rather than Private on the Form itself. I could use the TAG property to handle this (some controls.tag would be null) would be to my advantage. The following is code I’ve tried without success.
[indent]
Public Sub mmControls()
Dim f As Form
Dim C As Control
Set f = Forms![Main Menu]
For Each C In f
If C.Tag = “Dev” Then
C.Visible = True
If C.Tag = “Exec; Dev” Then
C.Visible = True
End If
If C.Tag = “Admin” Then
C.Visible = True
End If
If C.Tag = “Dev; Exec; Admin” Then
C.Visible = True
End If
‘ For Each C In F
‘Find the Control Tag property to determnine permissions
‘4 Possiblities: Dev, ExecAdmin, Admin, and User
‘ If C.Tag = “Dev”
‘ C.Visible = True
‘ End If
‘ Next C
‘Set C = f.C.Tag
‘ Select Case C
‘ Case 1 ‘Dev
‘ C.Visible = True
‘ Case 2 ‘Exec; Dev
‘ C.Visible = True
‘ Case 3 ‘Admin
‘ C.Visible = True
‘ Case 4 ‘Dev; Exec; Admin
‘ C.Visible = True
‘ End Select
Next C
[/indent]
The ‘‘ indicates code I’ve tried and didn’t work. If someone has a suggestion, I would love to here it.
Thanks,