Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get vertical lines to grow

Status
Not open for further replies.

dbapps

Programmer
Oct 21, 2002
9
0
0
GB
I have a sub report that is based on a continuous form. A couple of the fields have their Can Grow properties set to Yes. I want to seperate each field with a vertical line but can't figure out how to get them all to grow to the same height as the tallest text box in the line thus producing continus vertical lines down the page.

I've tried

Me![line1].[height] = Me![textbox1].[height]

but that just makes the line the same height as the text box on the first line and doesn't do it if one of the boxes on say line 3 is larger.

Any help gratefully received.
 
... = me.detail.height


Assuming, (of course) that the .top property is set to 0 to begin w/

and that the code is in the onprint event






MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
michael--please explain more. i was messing with this last night for a while, in the OnFormat event but couldnt get it to work. I tried me.Detail.height, and even me.field.height of one of the canGrow fields, but it only seems to return either 1) the height of the first row or 2) the height of the detail section at design time, not after it's grown. i have three row's worth of data, did debug.print and get 240, 240, 240 in debug window, even tho it's obvious that the third row is higher in print preview.

seeing your post this morning, i tried it in OnPrint. however get error message "Cannot set the Height property after printing has started".

anyhow, i just searched around the forum and found this, which worked beautifully. which i would have found this a long time ago:
thread703-391469
 
GingerR,

???? It would appear that you already have a more complete example. So, what else needs an explination?

The only potential confusion I see is the placement of the code. Since dbApps has the line in a SUBreport, the section reference may need to 'clarified'. On the other hand, the specific section can only be known where a more complete def of the situation is provided. The ref thread does not appear to be in (or referencing a sub-report).




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
i used it in a subreport and it worked perfectly.

i just wanted to know how you got it to work using detail.height cause i couldnt figure it out.
 
If you want a "line" the whole "Height" of the section, then set it's top at zero in the section and it's Height as the height of the section for a control. If it is the standard "ledger" report (single line of controls in the detail section which are reprated for each record), then as long as the section is 'expanding' with SOME control, the height is 'deternimed' when all of the controls are processed so after the controls, just do the line. But the controls are generally 'set up' in the onfromat event and hte onproint follows it so the onpront event is the appropiate place.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
i did that and it didnt work. as i said earlier, the only heights it reports (in debug.print) are what seems to me to be the orig height at design, even tho on my third row one of the text boxes was obviously three times taller than the first two rows because i shoved a bunch of text in the table. so i don't see that the 'new' height is determined OnFormat, or OnPrint. maybe it's 'determined' some place, but me.detail.height is not where it is. OnPrint, if the height *IS* determined then, i could not then set the height of the vertical line - got an error (mentioned in above post). so sorry but i just can't see it. if you have code that works i'd love to see it cause obviously i can't figure it out. thanks--g
 
but ... but ... but ... ... in DEBUG, it can only show the design height (at least as I recall). at least until AFTER the section is 'printed'. To see the 'recalculazted' height you need to look at it in a FOLLOWING section.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
GingerR

I've been away for few days and just read yours and MichaelRed comments. I'm glad I wan't the only person having this problem.

Did you eventually get the code to work as per the thread that you found? or did you have to make any changes to it?

I've printed it and will try it out later this evening.

Dave
 
it worked great for me the first time.
just copy it and paste the code into your report per the instructions in the post. no tweaking necessary. you have to delete all of your vertical lines i think it said--it builds them programmatically. you might wanna save a copy of your orig report in case it gets all honked up.

good luck--g
 


You would need to have a list of controls where the vertical lines are desired .

Call the routine once for EACH vertical line wanted.

This WILL be somewhat of a resource HOG for a production process.

Code:
Public Function BasVertLn(Form As String, MyCtrl As String, _
                          Optional LR As Boolean = True) As String

    'Michael Red, 12/1/2001
    'Draw a Vertical Line Beside a Control on a Report
    'where the control's Properties CanGrow and CanShrink may be TRUE

    Dim X1 As Double        'Left
    Dim Y1 As Double        'Top
    Dim X2 As Double        'Right
    Dim Y2 As Double        'Bottom
    Dim Offset As Long      'Border / Whitspace Width
    Dim LnColor As Double   'Line color to Draw

    Offset = 35 '(Hoizontal) Distance from the Control to the LINE

    'Must be CALED from OnPrint Event of Report. Similar to:

    'Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    '    MyCoords = basVarBox(Me.name, Expression.name, False) Lines to RIGHT
    'End Sub

'                               -OR-

    'Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    '    MyCoords = basVarBox(Me.name, Expression.name, True) Lines to LEFT
    'End Sub

    'Where:
    '   MyCoords is a Dummy (String) variable
    '   Me.Name is a constant (returns the Name of the REPORT)
    '   Expression(.Name) is the "name" of the Controls.

    'Left X  (Min of Left of the Control)
    X1 = Reports(Form).Controls(MyCtrl).Left
    X1 = X1 - Offset

    'Right X  (Max of Left + Width of the Controls)
    X2 = Reports(Form).Controls(MyCtrl).Left + Reports(Form).Controls(MyCtrl).Width
    X2 = X2 + Offset

    'Top Y  (Min of Top of the Controls)
    Y1 = Reports(Form).Controls(MyCtrl).Top
    Y1 = Y1 - Offset

    'Bottom Y (Max of Top + Height of the Controls)
    Y2 = Reports(Form).Controls(MyCtrl).Top + Reports(Form).Controls(MyCtrl).height
    Y2 = Y2 + Offset

    Select Case LR

        Case Is = True
            Reports(Form).Line (X1, Y1)-(X1, Y2), LnColor

        Case Is = False
            Reports(Form).Line (X2, Y1)-(X2, Y2), LnColor

    End Select

End Function

MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top