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

Help with making Labels not visible with no data 1

Status
Not open for further replies.

WallT

Vendor
Aug 13, 2002
247
US
I have the following in a text box on a report:

="Sex: " & [Sex] & "/ Race: " & [Race] & "/ Age: " & [Age] & "/ Height: " & [Ht] & "/ Weight: " & [Weight] & "/ Hair: " & [Hair] & "/ Eyes: " & [Eyes] & "/ Other: " & [DescriptionOther]

The problem I have is that I don't want the Text portions of this to show when there is no data like this:

Sex: / Race: / Age: / Height: / Weight: / Hair: / Eyes: / Other: (I don't want this to show if "Sex" is Null because there is always going to be a sex.) The form where this info. is entered forces "Sex" if any other fields are filled in, so if no "Sex" then nothing at all, and I don't want the report to display these labels.

I hope this makes sense. I would know how to do it if I had each one as a separate Text Box and Label, but not when I have it all under one text box. Hopefully it's possible because it looks much better like this.
 
Why do you have this all in one control? Surely it would look better in separate controls, no?

In any case, you can use a bunch of iif statements to get your job done...
=iif(isnull([sex]),"Sex: " & [Sex] & "/","") & iif(etc.)

Of course, it might be more accurate to do something like this:
=iif((isnull([sex],"Bummer","Ahhh")

Sorry. Couldn't resist.

Jeremy
=============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.


Remember to reward helpful tips with the stars they deserve.
 
I am trying to make it as compact as possible. I am not a programmer, so I only know how to do things a couple ways.
 
It's true that in a narrow control with Can Grow set to true this could end up saving you some real estate. In general,however, it's easier to read things when each bit of information is in it's own control. Think about looking at a page full of records with everything in one control. It becomes difficult to compare one record to another, because things shift around according to how many data items are missing. If you use individual controls, like items will always be in the same relative positions.

Hope this helps.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.


Remember to reward helpful tips with the stars they deserve.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top