Hi all!
I've got a treeview that is loaded with defaults depending on the logged-on user.
If the user tries to check a box that they do not have access to I display a message and then uncheck the box.
The problem seems to be that as I step through the routine, the box gets unchecked but then when the event is exited the box becomes checked again.
Private Sub TV1_NodeCheck(ByVal Node As MSComctlLib.Node)
Dim bAllowed As Boolean
' check to see if user has access to this module
bAllowed = False
Select Case Left(Node.Key, 1)
Case "F"
bAllowed = modF
Case "S"
bAllowed = modS
Case "O"
bAllowed = modO
Case "B"
bAllowed = modB
Case "M"
bAllowed = modM
Case "P"
bAllowed = modP
Case "H"
bAllowed = True
End Select
If Not bAllowed Then
MsgBox "You do not have access to this module.", vbOKOnly + vbExclamation, "Maintain Users Programs"
For Each nodeX In TV1.Nodes
If Left(nodeX.Key, 1) = Left(Node.Key, 1) Then
nodeX.Checked = False
End If
Next nodeX
Exit Sub
End If
Anyone got a solution for this?
TIA
Clegg
I've got a treeview that is loaded with defaults depending on the logged-on user.
If the user tries to check a box that they do not have access to I display a message and then uncheck the box.
The problem seems to be that as I step through the routine, the box gets unchecked but then when the event is exited the box becomes checked again.
Private Sub TV1_NodeCheck(ByVal Node As MSComctlLib.Node)
Dim bAllowed As Boolean
' check to see if user has access to this module
bAllowed = False
Select Case Left(Node.Key, 1)
Case "F"
bAllowed = modF
Case "S"
bAllowed = modS
Case "O"
bAllowed = modO
Case "B"
bAllowed = modB
Case "M"
bAllowed = modM
Case "P"
bAllowed = modP
Case "H"
bAllowed = True
End Select
If Not bAllowed Then
MsgBox "You do not have access to this module.", vbOKOnly + vbExclamation, "Maintain Users Programs"
For Each nodeX In TV1.Nodes
If Left(nodeX.Key, 1) = Left(Node.Key, 1) Then
nodeX.Checked = False
End If
Next nodeX
Exit Sub
End If
Anyone got a solution for this?
TIA
Clegg