Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Null values in nodes descriptions on a treeview

Posted on 2013-07-01
2
Medium Priority
?
541 Views
Last Modified: 2013-07-02
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

0
Comment
Question by:yahooooo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Expert Comment

by:edtechdba
ID: 39292011
How about using the IsNull function?

If IsNull([ABC Indicator]) Then
...
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 39292013
Are you getting errors with NZ?  The NZ should be inside the Cstr:

If CStr(NZ( PS![ABC Indicator], "")) = "A"

Open in new window


This is an alternative:


                           
If CStr("" & PS![ABC Indicator]) = "A" Then

Open in new window


Also - I dont think the CStr is needed at all...


If "" & PS![ABC Indicator] = "A" Then

Open in new window

0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question