Vertical line height to match detail height (1 Viewer)

Les Isaacs

Registered User.
Local time
Today, 20:51
Joined
May 6, 2008
Messages
184
Hi All
I have a report with a textbox in the detail section that has cangrow = true. The detail section also has two vertical lines, which I need to lengthen as necessary to match the textbox height.
I've tried searching for this online and in this forum, but can't seem to find the method - hopefully someone can help!
Thanks in advance.
Les
 

CJ_London

Super Moderator
Staff member
Local time
Today, 20:51
Joined
Feb 19, 2013
Messages
16,606
try in the detail on format sub putting something like

me.verticallinecontrolname.height=me.textboxcontrolname.height
 

Les Isaacs

Registered User.
Local time
Today, 20:51
Joined
May 6, 2008
Messages
184
I had tried

verticallinecontrolname.height=textboxcontro lname.height

which didn't work - and sadly neither does

me.verticallinecontrolname.height=me.textboxcontro lname.height

I'm sure it must be something like this, but can't quite get it!
 

isladogs

MVP / VIP
Local time
Today, 20:51
Joined
Jan 14, 2017
Messages
18,209
You haven't said where you're putting the code - it should be in the format event for the section containing the controls e.g. Detail_Format.

If it is there, it SHOULD work!

For example I have a report with 2 subreports, each of which can grow & a vertical line between them.
These are in the Page Header section.
The vertical line height is adjusted to equal the taller subreport using:

Code:
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)

If Me.rptsubEquipmentBookingsByItem.Height > Me.rptsubEquipmentBookingsByStaff.Height Then
    Me.Line1.Height = Me.rptsubEquipmentBookingsByItem.Height
Else
    Me.Line1.Height = Me.rptsubEquipmentBookingsByStaff.Height
End If

End Sub
 

Les Isaacs

Registered User.
Local time
Today, 20:51
Joined
May 6, 2008
Messages
184
Hi
No, it's in the right place I think:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Line50.Height = Me.Text65.Height
End Sub
 

isladogs

MVP / VIP
Local time
Today, 20:51
Joined
Jan 14, 2017
Messages
18,209
Hi
No, it's in the right place I think:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Line50.Height = Me.Text65.Height
End Sub

Assuming you've checked those are the correct control names, then that's odd.

Check the code is actually running
e.g. add the line MsgBox "TEST" before End Sub

If that does appear, then I'm out of ideas
 

fabibz

New member
Local time
Today, 21:51
Joined
Nov 18, 2018
Messages
1
the solution is to draw manually the lines in the detail_print event of the report or subreport

for 2 lines at each vertical border:

me.scalemode=1
me.forecolor =0 'black line
me.line(0,0)-(0,me.height)
me.line(me.width,0)-(me.width,me.height)

so easy when you finally find it
:banghead:
 

isladogs

MVP / VIP
Local time
Today, 20:51
Joined
Jan 14, 2017
Messages
18,209
Hi fabibz
Firstly welcome to the forum

Can you tell us why you think your solution is better than what has already been suggested
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 14:51
Joined
Feb 28, 2001
Messages
27,137
I think one step is missing. Yes, you can set line height of X to control height of Y - but if and ONLY if there is room to do so. You also need to take into account whether the line's .Top value allows it.

What I mean is that if the section is 1.000 inch high and the control height is 0.995 inches, you can make the line height 0.995 inches UNLESS the .Top of the line is greater than 0.005 inches. If THAT happens, the height does not reset and the section will not expand either (at least, I don't think it will, for a dynamic VBA height reset).

You didn't mention the height of the section or the relative positions of the line or the tops of the controls. I think you have to test whether you have room by verifying the values in .Top as well as .Height in order to make it work.
 

June7

AWF VIP
Local time
Today, 11:51
Joined
Mar 9, 2014
Messages
5,465
Be aware Format event only triggers in PrintPreview or direct to printer, not ReportView.
 

Users who are viewing this thread

Top Bottom