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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying something if field value is null 1

Status
Not open for further replies.

RiverGuy

Programmer
Jul 18, 2002
5,011
US
Hi. I have a report which has all the detail records hidden. My groups is all that I display. But one of the groups has a null value. I would like this to by my "Other Group".

So for my format I have

Null, data......
Group 1, data.....
Group 3, data.....
etc

How should I go about making it say "Other" for my Null named group?

 
What about something like this:
(where test3 is your field)

IIf(IsNull([test3]),"UNKNOWN",[test3]) J. Jones
jjones@cybrtyme.com
 
OK, that makes sense. I tried the exact thing, except I had IIf(IsNull([test3]),test3 = "UNKNOWN",[test3])

Because test3 was also the name of the text box. I'll give your way a shot.

Thanks.
 
Use the NZ Function. Nz([YourField],"Other")

Dermot
 
Where do you put this code to make it work?
I have a text field in its own header (Mtype Header). If it is null, I would like it to read "unknown". I tried:

IIf(IsNull([Mtype]),"UNKNOWN",[Mtype]) as the Mtype control source, as the control source for an unbound text box in the Mytype Header, and Report Header. It is either blank or I get #Error.

Any suggestions?


 
How about [highlight]=[/highlight]IIf(IsNull([Mtype]),"UNKNOWN",[Mtype])
?

Ken S.
 
I put
=IIf(IsNull([Mtype]),"UNKNOWN",[Mtype])
in the Mtype control box as the control source and received: #Error for all the Mtype (null and not null).

Am I supposed to put it someplace else?
 
The control is unbound, right? But you want to evaluate whether Mtype in the report's recordsource is null. What you have now is a circular reference. Name the control something else, i.e. txtMtype.

Ken S.
 
I never would have figured that out - thank you soooooo much!!!!
Works like a charm :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top