Microsoft Access - Make a sub report appear regardless if there is data

Asked By Jason on 11-Jan-12 04:33 PM
What I'm trying to do is have a sub report appear even if there is no data.  When I simply run the report in report view, the sub report will show up even if there is no data for it.  However when I output this report into .pdf or view it in print preview, the subreport disappears if there is no data.  Any ideas on how I could accomplish this?
Riley K replied to Jason on 11-Jan-12 08:55 PM


Open the Sub Report .rdl File and make the following changes:

In the bottom pane where Row Groups and Column groups are shown there is a black Triangle on the right hand side, click this and select "Advanced Mode".

This should then cause various items in grey labelled "(Static)" to appear in the Row Groups and Column Groups sections.

Click the top most entry marked "(Static)" in the row groups section to select it. This should cause the Properties pane to show properties for Tablix Member. 


In the properties change the HideIfNoRows property to True. 


Save the Sub-Report, then move to the parent report and run it - This should cause the sub-report to collapse as required


Regards.
Jitendra Faye replied to Jason on 11-Jan-12 10:42 PM
Use this code-

If Me!rptsubReason.Report.HasData = True Then
      Me!rptsubReason.Visible = True
    Else
      Me!rptsubReason.Visible = False
End if


Try this and let me know.
smr replied to Jason on 11-Jan-12 11:01 PM
hi

try this

In my main report, I use this code to determine whether I want the subreport. IF so, I retrieve a data set and assign it to my subreport. If not, I hide the subreport, expecting everything below it to move up.

If Me.IsDetailed Then
   Dim lDetailedSubreport As New IpmRehabPropIdDetailedSubReport()
   Dim lDetailedReader As SqlDataReader = GetIpmRehabPropertyIdDetailedSubReportDetails(Me.ApplicationId)
   lDetailedSubreport.DataSource = lDetailedReader
   Me.DetailedSubReport.Report = lDetailedSubreport
Else
   Me.DetailedSubReport.Visible = False
   Me.DetailedSubReport.Height = 0
   Me.DetailedSubReport.Report = Nothing
End If

Jason replied to Jitendra Faye on 18-Jan-12 03:10 PM
I'm not sure what to put in after the Me! and also I'm trying to show the report regardless if there is data.  That code looks like it shows it if there is data and hides it if there isn't.  I tried changing the false to true but I'm not sure what goes after Me!.   It just says field but everything I've tried doesn't work
Jason replied to smr on 18-Jan-12 03:11 PM
I'm having the same problem as my post above^
Jason replied to Riley K on 18-Jan-12 03:12 PM
I'm using Access 2007, I don't know if that makes a difference.  I see a groups section when I open up the report but i don't see advanced mode.  Not sure where to go from there
Jitendra Faye replied to Jason on 18-Jan-12 11:17 PM
After me, You have to put name of crystal report.
Pat Hartman replied to Jason on 20-Jan-12 07:18 PM
Change the CanShrink property of the subform to No.  As long as the subform has some height in design view, it will remain visible even when it has no data to display.
Jason replied to Pat Hartman on 23-Jan-12 04:08 PM
I figured that would be the case but that is not working in this situation.  Not sure what else is causing this subform to be hidden.