Solved

Hidden field labels keep report section from shrinking

Posted on 2004-09-17
7
421 Views
Last Modified: 2011-09-20
I have a report in which I'm using the following to hide labels if a field is empty:

If IsNull(Phone) Then
    PhoneLabel.Visible = False
Else
    PhoneLabel.Visible = True
End If

I have this set for several fields and it works great to hide those labels if there are no contents in the field, however the end result is a lot of white space before the start of the next report section, even though I have everything set to Can Shrink. The labels don't have that option, so what do I do to get them to not keep the detail section from shrinking to only the fields that contain data?

Thanks.
RWW
0
Comment
Question by:PstWood
[X]
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
  • 3
  • 3
7 Comments
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 50 total points
ID: 12086358
The only option I can think of would be to shove as much of this stuff towards the bottom of the section, then use VBA code to set the .Height property as high as possible when certain fields are blank.

Otherwise, I bet this is covered in Crystal Reports.

Hope this helps.
-Jim
0
 
LVL 15

Accepted Solution

by:
will_scarlet7 earned 50 total points
ID: 12086400
Hi Richard,
Are you asking how to shrink the detail section to avoid the blank space when there are empty fields? If so I think you can use the Top property of the controls to move them highter when visible is set to False and the height property of the detail section to shrink it.
0
 

Author Comment

by:PstWood
ID: 12087007
Thanks, Jim & "Will"
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12087110
Hope it was a help. ThanX for the points!

God bless!

Sam
0
 

Author Comment

by:PstWood
ID: 12087418
Well, I thought that would do it, but then I hit another snag. I have the following in my report onformat event:

If IsNull(Fax) Then
    FaxLabel.Visible = False
    FaxLabel.Top = 0
    FaxLabel.Height = 0
Else
    FaxLabel.Visible = True
    FaxLabel.Top = 0.5417
    FaxLabel.Height = 0.25
End If

The problem is that when the field is not empty, the label still doesn't show. If I remove the Top and Height stipulations, it works fine, but doesn't collapse when the Fax field is empty. Anyone have a solution?

Thanks.
RWW
0
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12087497
Richard, I think it may be that Access uses TWIPS as it's standard measurement when setting it in code. I think one inch is 1440 TWIPS, so it might work better like this:

If IsNull(Fax) Then
    FaxLabel.Visible = False
    FaxLabel.Top = 0
    FaxLabel.Height = 0
Else
    FaxLabel.Visible = True
    FaxLabel.Top = 780
    FaxLabel.Height = 360
End If
0
 

Author Comment

by:PstWood
ID: 12087782
That fixed it.
Thanks
RWW
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 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