View Full Version : Draw expanding lines in report detail


kec
11-22-2005, 07:18 AM
This code comes from Stephen Lebans, http://www.lebans.com/Report.htm

This code draws lines around each field in the report detail and expands with the text.

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim CtlDetail As Control
Dim intLineMargin As Integer

' Stephen Lebans 1999
' Stephen@ lebans.com
' www.lebans.com

' This is the spacing between the right edge of the
' control and the Vertical Seperation Line
intLineMargin = 0

' 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

-Ken

skea
12-04-2005, 10:30 PM
Thanks Kec....Ken:cool:

kec
12-05-2005, 08:02 AM
No problem skea.

I just wish I could remember where I got the code from so I could give credit where credit is due.

-Ken

Ron_dK
12-27-2005, 09:38 PM
I think this comes from Stephen Lebans.

see www.lebans.com

or

http://groups.google.nl/group/microsoft.public.access.reports/browse_thread/thread/173f0ed7474aa6a7/883d9ba77613c125?lnk=st&q=OK+lets+draw+a+vertical+line+to+seperate&rnum=1&hl=nl#883d9ba77613c125

kec
01-03-2006, 09:51 AM
Thanks Rak!

For the life of me I couldn't find the author of the code - and I had looked through Stephen's code, but missed it.

-Ken

JoeCruse
03-15-2006, 12:20 PM
Thanks, Ken. This was quite useful!