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?
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
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
 
SteveL13Author Commented:
By the way, I have this in the onformat event.
0
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.