This is how I do it. I layout my report without the vertical bars and each column has a column heading. And the width of each column headings is at least the width of the text box. Actually, the left coordinate of the heading will be where the vertical line begins.
Now assume you have 3 controls on your report: txt1, txt2, and txt3 with corresponding column headins of lblHead1, lblHead2, lblHead3. Also assume that all 3 of the controls' "Can Grow" property is set to true. In the OnPrint event of the Details section do something like this:
Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim sngHt As Single
'*************************
'* Draw Height of line *
'*************************
sngHt = txt1.Height
If (txt2.Height > sngHt) Then sngHt = txt2.Height
If (txt3.Height > sngHt) Then sngHt = txt3.Height
sngHt = sngHt + (Me.Detail.Height - txt1.Height)
'*************************
'* Draw vertical lines *
'*************************
Me.Line (lblHead1.Left, 0)-(lblHead1.Left, sngHt)
Me.Line (lblHead2.Left, 0)-(lblHead2.Left, sngHt)
Me.Line (lblHead3.Left, 0)-(lblHead3.Left, sngHt)
Me.Line (lblHead3.Left + lblHead3.Width, 0)-(lblHead3.Left + lblHead3.Width, sngHt)
End Sub
NOTE that the following 2 lines draw a vertical line beginning at the left coordinate of the heading.
Me.Line (lblHead1.Left, 0)-(lblHead1.Left, sngHt)
Me.Line (lblHead2.Left, 0)-(lblHead2.Left, sngHt)
The 1st line of the next 2 lines draws a vertical line beginning at the left coordinate of the heading. The next line draws the vertical line beginning at the right side of the heading.
Me.Line (lblHead3.Left, 0)-(lblHead3.Left, sngHt)
Me.Line (lblHead3.Left + lblHead3.Width, 0)-(lblHead3.Left + lblHead3.Width, sngHt)