Subreport label stays visible

C

CJ

Hi Groupies

I have a subreport in a report footer. The subreport is visible and
invisible depending on it's data content, no problem there.

My problem is that the label that is attached to the subreport does not
disappear with the rest of the report, so it is always visible. I actually
need the label for this subreport so I need some help in making the label
disappear please.

I have tried the following code but I think I am using the wrong event (or
wrong code) because it is not working. I tried a few different events with
no luck.

If Me.rsubKitParts.Report.Recordset.RecordCount = 0 Then
Me.rsubKitParts_Label.Visible = False
End If
 
A

Allen Browne

Right-click your label and Change To | Text Box.

Then set the Control Source property of the text box to an expression like
this:
=IIf([Report].[HasData], "Say this", Null)

Now if the subreport has any data, the text in quotes appears. Otherwise the
text box is null (so shows nothing.)
 
C

CJ

Hi Allen

I did try that type of option, however, although the words are invisible the
text box control stays and takes up space.

Is there a way to make it disappear so that the Can Shrink functionality can
reclaim that space on my report?

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Allen Browne said:
Right-click your label and Change To | Text Box.

Then set the Control Source property of the text box to an expression like
this:
=IIf([Report].[HasData], "Say this", Null)

Now if the subreport has any data, the text in quotes appears. Otherwise
the text box is null (so shows nothing.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

CJ said:
Hi Groupies

I have a subreport in a report footer. The subreport is visible and
invisible depending on it's data content, no problem there.

My problem is that the label that is attached to the subreport does not
disappear with the rest of the report, so it is always visible. I
actually need the label for this subreport so I need some help in making
the label disappear please.

I have tried the following code but I think I am using the wrong event
(or wrong code) because it is not working. I tried a few different events
with no luck.

If Me.rsubKitParts.Report.Recordset.RecordCount = 0 Then
Me.rsubKitParts_Label.Visible = False
End If
 
A

Allen Browne

It should shink if there is nothing else beside that text box vertically
that requires space, and you have set the Can Shrink property to Yes for all
these:
- the text box
- the section of the subreport that contains the text box
- the subreport control on the main report
- the section of the main report that contains the subreport control.

If you can't get that to work, you might consider placing the text box on
the main report instead. Set its Control Source to:
=IIf([Sub1].[Report].[HasData], "Say this", Null)
substituting the name of your subreport control for Sub1.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

CJ said:
Hi Allen

I did try that type of option, however, although the words are invisible
the text box control stays and takes up space.

Is there a way to make it disappear so that the Can Shrink functionality
can reclaim that space on my report?

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Allen Browne said:
Right-click your label and Change To | Text Box.

Then set the Control Source property of the text box to an expression
like this:
=IIf([Report].[HasData], "Say this", Null)

Now if the subreport has any data, the text in quotes appears. Otherwise
the text box is null (so shows nothing.)

CJ said:
Hi Groupies

I have a subreport in a report footer. The subreport is visible and
invisible depending on it's data content, no problem there.

My problem is that the label that is attached to the subreport does not
disappear with the rest of the report, so it is always visible. I
actually need the label for this subreport so I need some help in making
the label disappear please.

I have tried the following code but I think I am using the wrong event
(or wrong code) because it is not working. I tried a few different
events with no luck.

If Me.rsubKitParts.Report.Recordset.RecordCount = 0 Then
Me.rsubKitParts_Label.Visible = False
End If
 
C

CJ

Well Good Grief, I missed the Can Shrink on the actual text box.....didn't
scroll far enough..

Thanks for the brilliance Allen!!

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Allen Browne said:
It should shink if there is nothing else beside that text box vertically
that requires space, and you have set the Can Shrink property to Yes for
all these:
- the text box
- the section of the subreport that contains the text box
- the subreport control on the main report
- the section of the main report that contains the subreport control.

If you can't get that to work, you might consider placing the text box on
the main report instead. Set its Control Source to:
=IIf([Sub1].[Report].[HasData], "Say this", Null)
substituting the name of your subreport control for Sub1.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

CJ said:
Hi Allen

I did try that type of option, however, although the words are invisible
the text box control stays and takes up space.

Is there a way to make it disappear so that the Can Shrink functionality
can reclaim that space on my report?

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Allen Browne said:
Right-click your label and Change To | Text Box.

Then set the Control Source property of the text box to an expression
like this:
=IIf([Report].[HasData], "Say this", Null)

Now if the subreport has any data, the text in quotes appears. Otherwise
the text box is null (so shows nothing.)

Hi Groupies

I have a subreport in a report footer. The subreport is visible and
invisible depending on it's data content, no problem there.

My problem is that the label that is attached to the subreport does not
disappear with the rest of the report, so it is always visible. I
actually need the label for this subreport so I need some help in
making the label disappear please.

I have tried the following code but I think I am using the wrong event
(or wrong code) because it is not working. I tried a few different
events with no luck.

If Me.rsubKitParts.Report.Recordset.RecordCount = 0 Then
Me.rsubKitParts_Label.Visible = False
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top