Hide subreport if it has no data (1 Viewer)

Catalina

Registered User.
Local time
Today, 01:21
Joined
Feb 9, 2005
Messages
462
In Access 2010 I'm trying to hide a sub report in the Detail section if it has no data.

I found some possible solutions in this forum as well as on other sites.
Tried them all, and none of them work for me. The sub stays visible no matter what I do.
The set shrink to yes doesn't do anything either.

Any suggestions how to accomplish this?

Thanks.
 

Catalina

Registered User.
Local time
Today, 01:21
Joined
Feb 9, 2005
Messages
462
Somehow I got it to work.
If I remembered what I did to make it work I would have posted it here.
 

321jimk

Registered User.
Local time
Today, 09:21
Joined
Jul 10, 2011
Messages
12
that's soo wrong!!
 

GinaWhipp

AWF VIP
Local time
Today, 04:21
Joined
Jun 21, 2011
Messages
5,899
Well, this works...

Code:
Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
On Error Resume Next
If Me.srpPOSpecialNotes.Report.HasData Then
Me.lblSpecialNote.Visible = True
Else
Me.lblSpecialNote.Visible = False
End If
End Sub

You can use variations to make subreports, text boxes, etc... visible or not.
 

Catalina

Registered User.
Local time
Today, 01:21
Joined
Feb 9, 2005
Messages
462
Thanks Gina, I'll keep that code handy.

Catalina
 

HIMANSHU

Registered User.
Local time
Today, 13:51
Joined
Jul 27, 2013
Messages
28
I want that if the sub report has no data then it should not be displayed and at the same time the blank space which is generated by it should also be removed...

I am able to remove the subreport with no data with the above code but the blank space still persists...

Pls Help
 

GinaWhipp

AWF VIP
Local time
Today, 04:21
Joined
Jun 21, 2011
Messages
5,899
HIMANSHU,

In the Section that contains the Subreport set the Can Shrink proprty to *Yes*.

Side Note: It's always better to start your own thread then attach your question to another thread. You have a better chance of getting answers that way!
 

HIMANSHU

Registered User.
Local time
Today, 13:51
Joined
Jul 27, 2013
Messages
28
Point taken Gina...thanks...started a new thread...
 

Users who are viewing this thread

Top Bottom