Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with not showing fields that are blank

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I have a directory report and each family could have upto 4 children. I would like not to see pipe symbol(s) and the "dash" in between if there is not 2nd, 3rd or 4th child.
Currently this is what I get
Jake - 1| - | - | -
so Jake is in first grade and he has no siblings

Danielle - 4 | Matt - 3 | Andy - K | -
and the next one has 3 children with a trailing dash since there is no 4th child.

I would like the trailing pipe symbol(s) and the dash(s) to disappear when there are no more children.

Eveyone has at least one child or they would not be in the directory at all.
This is my code but it does not work for the fourth child as a test. I still get a dash,
Code:
=IIf([child4]=Null,"",[child4] & "-" & [child4grade])

What am I missing?

TIA



DougP
 
This never returns true: [child4] = null
If child4 is in fact null the expression returns Null not True

isNull([Child4]) returns true or false. Use isnull function

also another trick
"string" + Null = Null
"string" & Null = string

= [child4] + "-" + [child4grade]
returns null (empty) if child 4 null
= [child4] & "-" & [child4Grade]
returns "-" if child 4 is null

test this in the debug window
x = null
debug.print X = null
Null
debug.print isnull(x)
True
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top