G
g
Hi, is there other way you can make this code shorter. This is just a sample
and it will go more than this.
Private Sub TreeView1_Expand(ByVal Node As Object)
Dim VarAA As Variant
Dim VarBB As Variant
Dim VarCC As Variant
VarAA = DLookup("TAH", "table_EmpProfile", "EmpName=UName2.Value")
VarBB = DLookup("MAH", "table_EmpProfile", "EmpName=UName2.Value")
VarCC = DLookup("WAH", "table_EmpProfile", "EmpName=UName2.Value")
If Node.Text = "TAH" Then
If VarBB = -1 Then
TreeView1.Nodes("B1").Expanded = False
End If
If VarCC = -1 Then
TreeView1.Nodes("C1").Expanded = False
End If
ElseIf Node.Text = "MAH" Then
If VarAA = -1 Then
TreeView1.Nodes("A1").Expanded = False
End If
If VarCC = -1 Then
TreeView1.Nodes("C1").Expanded = False
End If
ElseIf Node.Text = "WAH" Then
If VarAA = -1 Then
TreeView1.Nodes("A1").Expanded = False
End If
If VarBB = -1 Then
TreeView1.Nodes("B1").Expanded = False
End If
*I need to use the condition to check if the column TAH,MAH and WAH are true
coz some employe sometimes has 2 or more site assigned.
Thank you
and it will go more than this.
Private Sub TreeView1_Expand(ByVal Node As Object)
Dim VarAA As Variant
Dim VarBB As Variant
Dim VarCC As Variant
VarAA = DLookup("TAH", "table_EmpProfile", "EmpName=UName2.Value")
VarBB = DLookup("MAH", "table_EmpProfile", "EmpName=UName2.Value")
VarCC = DLookup("WAH", "table_EmpProfile", "EmpName=UName2.Value")
If Node.Text = "TAH" Then
If VarBB = -1 Then
TreeView1.Nodes("B1").Expanded = False
End If
If VarCC = -1 Then
TreeView1.Nodes("C1").Expanded = False
End If
ElseIf Node.Text = "MAH" Then
If VarAA = -1 Then
TreeView1.Nodes("A1").Expanded = False
End If
If VarCC = -1 Then
TreeView1.Nodes("C1").Expanded = False
End If
ElseIf Node.Text = "WAH" Then
If VarAA = -1 Then
TreeView1.Nodes("A1").Expanded = False
End If
If VarBB = -1 Then
TreeView1.Nodes("B1").Expanded = False
End If
*I need to use the condition to check if the column TAH,MAH and WAH are true
coz some employe sometimes has 2 or more site assigned.
Thank you