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

Getting labels to shrink

Status
Not open for further replies.

sophie

MIS
May 31, 2001
4
0
0
US
Hi all,

I want to get my labels to my controls to shrink if there's a null value for that control. I can get my control to shrink (easy!), but I can't find a way for my labels to also disappear when there's a null value. Any wisdom on this matter would be gratefully received!

Sophie
 
Hi Sophie, I'm copy/pasting out of another post I made today and I'll try to adapt it especially for you!

It's a little work but not too hard:
Place your report in design view and double-click on the "detail" bar to pop up its properties. Select the event tab then find "On Format". In its "field" choose "event procedure" then click on the ellipse "..." button just to the right. This will open up the visual basic module for this report and label a "sub" for you for this event.
You'll want to enter something like this between the title and "end sub" lines:

If IsNull(Me![NameOfFieldThatMightBeNull) Then
Me![NameOfYourLabel].Visible = False
Else
Me![NameOfYourLabel].Visible = True
End If

You can add in as many other labels as you wish to show or not show. Give it a go!
Gord
ghubbell@total.net
 
Hi Gord,

Many, many thanks for the suggestion. It's working like a dream!

Sophie.
 
This works, except.. how do you shrink it? It hides it but does not move the data below it up. It just makes it a blank space. Thanks!
-JusTin
 
Correction: How do you get the LABEL to shrink like the text box? Thanks!
-JusTin
 
How can I convert this to use when the value of the control is 0?

Thanks,
Melissa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top