Solved

Hidden field labels keep report section from shrinking

Posted on 2004-09-17
7
414 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
  • 3
  • 3
7 Comments
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks, Jim & "Will"
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 15

Expert Comment

by:will_scarlet7
Comment Utility
Hope it was a help. ThanX for the points!

God bless!

Sam
0
 

Author Comment

by:PstWood
Comment Utility
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
Comment Utility
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
Comment Utility
That fixed it.
Thanks
RWW
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now