Vertical lines that grow with the fields

binoj

Registered User.
Local time
Today, 14:24
Joined
Jun 1, 2009
Messages
15
I have a report that has a "comments" field that can grow along with few other fields that do not grow. I need to get vertical lines between the headers to form columns. How can I make the vertical lines grow with the fields so that it looks like one continuous line from top to bottom?

I used the code provided by stephen lebans on his site in the print event of the detail section of the report. Nothing happens on my report. The code compiled without any errors. Not sure what I am missing. I have attached the database. The name of the report is Table1. For the report to work, the Main Form should be open. Can someone take a look at the database and suggest a solution.

Any help is greatly appreciated.



Option Compare Database
Option Explicit
' Stephen Lebans 1999
' Stephen@ lebans.com
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim CtlDetail As Control
Dim intLineMargin As Integer
' This is the spacing between the right edge of the
' control and the Vertical Seperation Line
intLineMargin = 40
' OK lets draw a vertical line to seperate each field
' for each control in details control
' If your last control on the right does not end on the edge of the section
' you will get a second vertical line. If you need to get around this then you
' can skip drawing this last Vertical Seperation Line in a couple of ways.
' We'll use the control name method Here. Our right most control is named
' TestMemo. IF current control is TestMemo - Do not print Vertical Line
For Each CtlDetail In Me.Section(acDetail).Controls
With CtlDetail
'If CtlDetail.name <> "TestMemo" Then
Me.Line ((.Left + .Width + intLineMargin), 0)-(.Left + .Width + _
intLineMargin, Me.Height)
'End If
End With
Next

'While we are here lets draw a box around the Detail section
With Me
Me.Line (0, 0)-Step(.Width, .Height), 0, B
End With
'Set CtlDetail = Nothing
End Sub
 

Attachments

When I run your report I see vertical lines cover the full height of your detail section. Is that not what you are expecting? This is what Lebans' code is supposed to do I think.

Or are you not seeing any vertical lines? Make sure you view the report in Print Preview. The "Line" method is only draw at the print stage.

hth
Chris
 
That's exactly what I was missing. I was using the report view. I should have used the print preview instead as you suggested. It's an on print event.

Thanks a lot.
 

Users who are viewing this thread

Back
Top Bottom