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
Solved

Null values in nodes descriptions on a treeview

Posted on 2013-07-01
2
519 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
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 500 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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.

791 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