Link to home
Start Free TrialLog in
Avatar of yahooooo
yahoooooFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Null values in nodes descriptions on a treeview

Guys

I wonder if it's possible to sort out nulls among items which I display as a node description.
In this case a have few ABC Indicators which are null so I'd avoid changing their value to N/A and add some if statement to omit them. I tried to equal it to null and iserror but no luck.
As you can see below I tried Nz() as well


                            If Nz(CStr(PS![ABC Indicator])) = "A" Then
                                Set a = TreeView.Nodes.Add(CStr(PS![Superior Function Location]), tvwChild, CStr(PS![Functional location]), CStr(PS![Functional location]) & "     (" & CStr(PS![Function Location Description]) & ")" & "     (" & Nz(CStr(PS![ABC Indicator])) & ")" & "     (" & CStr(PS![Object type]) & ")" & "     (" & CStr(PS![Object Type Desc]) & ")")
                                a.ForeColor = RGB(63, 23, 127) 'violet
                            ElseIf Nz(CStr(PS![ABC Indicator])) = "B" Then
                                Set a = TreeView.Nodes.Add(CStr(PS![Superior Function Location]), tvwChild, CStr(PS![Functional location]), CStr(PS![Functional location]) & "     (" & CStr(PS![Function Location Description]) & ")" & "     (" & Nz(CStr(PS![ABC Indicator])) & ")" & "     (" & CStr(PS![Object type]) & ")" & "     (" & CStr(PS![Object Type Desc]) & ")")
                                a.ForeColor = RGB(255, 97, 3) 'orange
                            ElseIf Nz(CStr(PS![ABC Indicator])) = "C" Then
                                Set a = TreeView.Nodes.Add(CStr(PS![Superior Function Location]), tvwChild, CStr(PS![Functional location]), CStr(PS![Functional location]) & "     (" & CStr(PS![Function Location Description]) & ")" & "     (" & Nz(CStr(PS![ABC Indicator])) & ")" & "     (" & CStr(PS![Object type]) & ")" & "     (" & CStr(PS![Object Type Desc]) & ")")
                                a.ForeColor = RGB(24, 116, 205) 'blue
                            Else
                                Set a = TreeView.Nodes.Add(CStr(PS![Superior Function Location]), tvwChild, CStr(PS![Functional location]), CStr(PS![Functional location]) & "     (" & CStr(PS![Function Location Description]) & ")" & "     (" & CStr(PS![Object type]) & ")" & "     (" & CStr(PS![Object Type Desc]) & ")")
                            End If

Open in new window

Avatar of edtechdba
edtechdba
Flag of United States of America image

How about using the IsNull function?

If IsNull([ABC Indicator]) Then
...
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial