Report: Varying Control Positions Depending On SubReport's Size?

P

PeteCresswell

Got a report with a subreport in it.

The detail section has a box around it.

Have recently added the subreport to the detail section.

..CanGrow=True
..CanShrink=True

I want to expand the enclosing rectangle and push down some labels to
accomodate varying sizes of subreports.

Some subreports have zero items, some have 1 item, others have many
items.

Here's what I'm doing now, but it doesn't seem tb capturing the new
size of each subreport.

The subreport is in .subLadderChildren, the rectangle is
called .rctMain, and
the label names all begin with .lblSignoff_
--------------------------------------------------------------------------------
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
1000 DebugStackPush Me.Name & ": Detail_Format"
1001 On Error GoTo Detail_Format_err

' PURPOSE: - To give a little more distinction between buys and
sells
' by toggling the back/forecolors
' - To push the signoff line/labels down to accomodate the
' varying size of the subreport
' - To size the enclosing rectangle per size of subreport

1002 Dim newSignoffTop As Long

Const vPad As Long = 50

1009 Cancel = mNoData

1010 If mNoData = False Then
1011 With Me.txtTradeType
1012 If .Value = "Sell" Then
1013 .BackColor = gColor_JetBlack
1014 .ForeColor = gColor_White
1019 Else
1020 .BackColor = gColor_White
1021 .ForeColor = gColor_JetBlack
1022 End If
1029 End With

' --------------------------------------
' Attempt to capture height of subform
' and concoct a .Top for the signoff line
' from it

1040 With Me.subLadderChildren
1041 newSignoffTop = .Top + .Height + vPad
1049 End With
' --------------------------------------

1050 With Me
1051 .linSignoff.Top = newSignoffTop
1052 .lblSignoff_Confirmation.Top = newSignoffTop + vPad
1053 .lblSignoff_Contact.Top = newSignoffTop + vPad
1054 .lblSignoff_Date.Top = newSignoffTop + vPad
1055 .lblSignoff_Time.Top = newSignoffTop + vPad
1059 End With

1060 With Me.rctMain
1061 .Height = .Top + Me.lblSignoff_Confirmation.Top +
Me.lblSignoff_Confirmation.Height
1069 End With

1999 End If

Detail_Format_xit:
DebugStackPop
On Error Resume Next
Exit Sub

Detail_Format_err:
BugAlert True, ""
Resume Detail_Format_xit
End Sub
--------------------------------------------------------------------------------
 
P

PeteCresswell

It's dawned on me about not being able to change the size of a control
dynamically.

Accordingly, I replaced rctMain with a call to .Line:
' --------------------------------------
' Draw the rectangle

1060 With Me
1061 rctMain_Bottom = .Section(0).Height
'.lblSignoff_Confirmation.Top + .lblSignoff_Confirmation.Height + vPad
+ .subLadderChildren.Height
1069 End With

1990 Me.Line (0, (vPad * 2))-(Me.Width, rctMain_Bottom), RGB(0, 0,
0), B
' --------------------------------------

But the original problem remains: How to dynamically get the size of
the area. Section(0).Height does not seem to change even though
varying-size subforms push it's lower boundry up and down.
 

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

Top