Collapse subreport

  • Thread starter Thread starter Caroline
  • Start date Start date
C

Caroline

(Sorry if this posts twice, I got booted off).
Is it possible to collapse/expand a subreport in a report? I have added a
subreport in a report that I would like to collapse and expand much like a
subdatasheet in a table.
Is this possible?
Thanks,
Caroline
 
You can set the sub-report control's CanGrow and CanShrink properties just
like every other control.

You can hide a sub-report by checking its HasData property and using VBA to
Hide or Show it based on the that property.

In the section of the report where the Sub-report is, use code something like
the following.

IF Me.SubReportControl.Report.HasData Then
ME.SubReportControl.Visible = True
ELSE
ME.SubReportControl.Visible = False
END IF



John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
John thank you. What I want is to have + and - signs that would let me expand
and collapse at will, without going through the design tab -just like a sub
data sheet. Is that a possibility?
 
No, that is not possible with Access reports. In preview mode, an Access
report is a static representation of the data. In other words, preview mode
is an electronic picture of what the paper would look like (at least it is
supposed to be an accurate representation).

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
That makes sense... I will have to use forms for what I want to accomplish.
Thanks for your time!
C
 
That makes sense... I will have to use forms for what I want to accomplish.
Thanks for your time!
C

You could create a couple buttons to accomplish what you are looking
for.

One to hide the Subreport
Me.SubReport.Visible = False
Me.HideButton.Visible = False
Me.ShowButton.Visible = True

And one to show the Subreport
Me.SubReport.Visible = True
Me.HideButton.Visible = True
Me.ShowButton.Visible = False

Keven Denen
 
Buttons don't work on a report - they are just pictures of buttons. And if
you put them elsewhere, you have the very difficult problem of determining
where the active portion of the report is and causing the report to be redrawn.

Perhaps this ability will be available in the some future version of Access.
I don't know that it will be or won't be, just sheer speculation.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top