-----Original Message-----
Standard lines from the toolbox do not have this
ability. However; you can draw
lines using code in the Format event of the relevant section. Look in help for the
Line Method. You draw lines using a x-y coordinate
system so it takes a bit of trial
and error to get them positioned just how you want them.
For growing sections you take advantage of a particular behavior of lines drawn this
way. A line drawn in the format event of a section cannot extend out of that
section. Y coordinate zero is always at the top of the section (not the page).
Likewise, no matter how large of a y coordinate you use the line will not extend past
the bottom of your section. So... if you just make the y coordinate a very large
number, the line will always extend to the bottom of the section, even as it grows
and shrinks.
Currently I am using code in the Detail section under on
Print. The code is:
Option Compare Database
Option Explicit
Dim IngPage As Long
' this code uses Lines set into the detail section (TEXT)
' that have their Visible property set to False. (TEXT)
' We redraw new lines in the same location that (TEXT)
' are slightly larger than the tallest TextBox (TEXT)
Private Sub Detail_print(Cancel As Integer, PrintCount As
Integer)
Dim sngLineTop As Single
Dim sngLineLeft As Single
Dim sngLineWidth As Single
Dim sngLineHeight As Single
Dim ctl As Control
Dim lngH As Long
'if new page then draw a line at the top of the detail
section (TEXT)
'If IngPage <> Me.Page Then (FORMULA!!!)
'Me.Line (0, 0)-Step(Me.Width, 0) (FORMULA!!!)
'IngPage = Me.Page (FORMULA!!!)
'End If (FORMULA!!!)
'get the height of the tallest TextBox (TEXT)
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If Me(ctl.Name).Height > lngH Then
lngH = Me(ctl.Name).Height
End If
End If
Next ctl
'draw a new line in the same spot as existing lines (TEXT)
For Each ctl In Me.Controls
If ctl.ControlType = acLine Then
'sngLineTop = Me(ctl.Name).Top (FORMULA!!!)
'4320 twips equals 3 inches (TEXT)
sngLineLeft = Me(ctl.Name).Left
'20 twips equals approximately 1 point (1/72 inch)
(TEXT)
'sngLineWidth = Me(ctl.Name).Width (FORMULA!!!)
sngLineHeight = lngH
'sngLineHeight = 0 + lngH + 10 (COPIED FORMULA)
Me.Line (sngLineLeft, sngLineTop)-Step(sngLineWidth,
sngLineHeight)
End If
Next ctl
'draw a line at the bottom of the Detail Section (TEXT)
'sngLineTop = lngH + 10 (FORMULA!!!)
'sngLineLeft = 0 (FORMULA!!!)
'sngLineWidth = Me.Width (FORMULA!!!)
'sngLineHeight = 0 (FORMULA!!!)
'Me.Line (sngLineLeft, sngLineTop)-Step(sngLineWidth,
sngLineHeight) (FORMULA!!!)
End Sub
The problem is that the lines are appearing where needed
as well as other places. How would I control where the
lines appear?