Collapse subreport

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
 
J

John Spencer

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
 
C

Caroline

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?
 
J

John Spencer

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
 
C

Caroline

That makes sense... I will have to use forms for what I want to accomplish.
Thanks for your time!
C
 
C

CompGeek78

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
 
J

John Spencer

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
 

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

Similar Threads


Top