Hide labels and shrink detail section

On the detail section of a report I am trying to hide two labels and at the same time shrink the detail section to save space.  I do have the detail section and the contrls set to shrink and grow but this isn't working.  Here is my code but it's not working...

    If Me.txtQComment = "" Then
        Me.lblQI.Visible = False
    End If

    If Me.txtDescription = "" Then
        Me.lblDept.Visible = False
    End If

--Steve
SteveL13Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SteveL13Author Commented:
By the way, I have this in the onformat event.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
What about using Null

    If Me.txtQComment = Null Then
        Me.lblQI.Visible = False
    End If

    If Me.txtDescription = Null Then
        Me.lblDept.Visible = False
    End If

mx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GRayLCommented:

    If Nz(Me.txtQComment,"") = "" Then
        Me.lblQI.Visible = False
    End If

    If Nz(Me.txtDescription,"") = "" Then
        Me.lblDept.Visible = False
    End If

0
Jeffrey CoachmanMIS LiasonCommented:
In addition, ...hiding a control will not make the detail section any smaller.
If the control is hidden it is still *There* and hence will take up the same amount of vertical space.

If I am understanding your question here, there are many ways to do what you are asking, depending on the layout of your form (which you did not provide)

But in essence you need to "Shrink" the height of the control, then shrink the height of the detail section correspondingly.

This works great if the control you are shrinking is at the bottom of the detail section, if it is not, then you also have to move all of the remaining controls "Up" (to fill the empty space left by the "Shrunken" label)

This all may not be really worth all the trouble.

Can you first take a step back and post the design of your form, then clearly illustrate your goal here.

Thanks

JeffCoachman
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.