J
judyg73
I am using the following code - which is working "almost" the way I need it.
My problem is that when the control expands to allow for the tallest control,
then it puts an extra line in another control on the page. It seems to be
putting the extra line in approximately the same spot at the top of the page.
The line only appears if one of the controls on the page has adjusted to
accomodate all of the data in the memo field. If everything fits in the
control that is set to a specific size, then there is no line. This report
is 2 pages long which includes a sub report that I have on the second page.
The sub report is using this same code. I have several reports that I am
going to need to use this code in, so any suggestions would be appreciated.
In the Detail Section, set each control's Border property to
Transparent.
Set the Detail Section's CanGrow property to Yes.
Set the Memo field's CanGrow property to Yes.
Set the Memo field's CanShrink property to No.
Size all of the controls to the same Height.
Place the following code in the Report Detail Print event:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
' draws a box around each control,
' set to the height of the tallest control on that line.
Dim lngHeight As Long
Dim X1 As Single
Dim Y1 As Single
Dim Y2 As Single
Dim X2 As Single
Me.DrawStyle = 0
' Find the height of the tallest control in the row
Dim c As Control
For Each c In Me.Section(0).Controls
If c.Height > lngHeight Then
lngHeight = c.Height
End If
Next
' Draw the box around the record
For Each c In Me.Section(0).Controls
X1 = c.Left
X2 = c.Left + c.Width
Y1 = c.Top
Y2 = lngHeight
Me.Line (X1, Y1)-(X2, Y2), vbBlack, B
Next c
End Sub
My problem is that when the control expands to allow for the tallest control,
then it puts an extra line in another control on the page. It seems to be
putting the extra line in approximately the same spot at the top of the page.
The line only appears if one of the controls on the page has adjusted to
accomodate all of the data in the memo field. If everything fits in the
control that is set to a specific size, then there is no line. This report
is 2 pages long which includes a sub report that I have on the second page.
The sub report is using this same code. I have several reports that I am
going to need to use this code in, so any suggestions would be appreciated.
In the Detail Section, set each control's Border property to
Transparent.
Set the Detail Section's CanGrow property to Yes.
Set the Memo field's CanGrow property to Yes.
Set the Memo field's CanShrink property to No.
Size all of the controls to the same Height.
Place the following code in the Report Detail Print event:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
' draws a box around each control,
' set to the height of the tallest control on that line.
Dim lngHeight As Long
Dim X1 As Single
Dim Y1 As Single
Dim Y2 As Single
Dim X2 As Single
Me.DrawStyle = 0
' Find the height of the tallest control in the row
Dim c As Control
For Each c In Me.Section(0).Controls
If c.Height > lngHeight Then
lngHeight = c.Height
End If
Next
' Draw the box around the record
For Each c In Me.Section(0).Controls
X1 = c.Left
X2 = c.Left + c.Width
Y1 = c.Top
Y2 = lngHeight
Me.Line (X1, Y1)-(X2, Y2), vbBlack, B
Next c
End Sub