Boxing around a subreport in a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report that contains some textboxes and a subreport that I want to
group together visually by putting a box around them all. I've put in a box
from the control toolbox, but when the subreport has more than three or four
entries, the box doesn't change size to include all the textboxes and
subreport that I want to keep together. I'd like the box to be able to stay
small when the subreport is small, but enlarge as the number of entries in
the subreport increases. Any ideas?

Thanks,
Dave
 
Assuming
-your controls and subreport are in the detail section
-your "box" is named "boxInvisible" and
-your subreport control is named "srptA" and
-you want your box/rectangle around the controls and subreport to extend
1/10" below the bottom of srptA
-you want to draw a thicker red box around the controls

You can
-set your rectangle control's Visible property to No and
-add code to the On Print of the detail section like:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim intGrownHeight As Integer
Me.DrawWidth = 15
Me.ForeColor = vbRed
intGrownHeight = Me.srptA.Height + _
(Me.srptA.Top - Me.boxInvisible.Top) + 144
Me.Line (Me.boxInvisible.Left, Me.boxInvisible.Top)- _
Step(Me.boxInvisible.Width, intGrownHeight), , B
End Sub
 
Back
Top