Link to home
Start Free TrialLog in
Avatar of PstWood
PstWood

asked on

Hidden field labels keep report section from shrinking

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
SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PstWood
PstWood

ASKER

Thanks, Jim & "Will"
Hope it was a help. ThanX for the points!

God bless!

Sam
Avatar of PstWood

ASKER

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
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
Avatar of PstWood

ASKER

That fixed it.
Thanks
RWW