Need help again Gridlines

alfred67

Registered User.
Local time
Today, 02:28
Joined
Jan 26, 2010
Messages
65
Hello

I'm using the following to create gridlines in my report which works great if my data is in the Detail part of the report but my data is in the Item No Header section. What do I have to change to get the code to work??

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 = 60
' 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

Alfred67
 
Try changing the line:
For Each CtlDetail In Me.Section(acDetail).Controls

to:
For Each CtlDetail In Me.Section(acGroupLevel1Header).Controls

If this does not work as expected, check out the VBA Help file for info about how to reference any section of your report.
 
No didn't work :-(

Alfred67
 

Users who are viewing this thread

Back
Top Bottom