Solved

Hidden field labels keep report section from shrinking

Posted on 2004-09-17
7
419 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
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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

839 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