Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Draw a line

Status
Not open for further replies.

LonnieJohnson

Programmer
Apr 16, 2001
2,628
US
What if I have 10 text boxes on a form all across in a row and I wanted to put a box around the first 5 and another box (boarder) around the second 5? This box/border would expand the height of the detail section of each page. I was thinking of the Me.Line method but don't know how to

1) Just put it around certain boxes

2) How to have more than one line method going on at once.

Thanks.

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
You could try to adapt the following code.
This code was intended to draw vertical lines on a report for the entire detail section (even if blank lines). It would read database records that define the vertical spacing.

Private Sub Report_Page()
DrawLine
End Sub



Sub DrawLine()
Dim rpt As Report, lngColor As Long
Dim sngTop As Single, sngLeft As Single
Dim sngHeight As Single, sngWidth As Single
Dim sngTopAdjust As Single, sngLeftAdjust As Single
Dim sngWidthAdjust As Single, sngHeightAdjust As Single
Dim rstLines As DAO.Recordset

On Error GoTo Error_Trap
Set rpt = Reports("MyReport")
rpt.ScaleMode = 5 ' Set scale to pixels.

Set rstLines = gv_DBS_Local.QueryDefs!LinesToDraw.OpenRecordset
With rstLines

Do While Not .EOF
sngTopAdjust = !Top
sngLeftAdjust = !Left
sngWidthAdjust = !Width
sngHeightAdjust = !Height

sngTop = rpt.ScaleTop + sngTopAdjust ' Top inside edge.
sngLeft = rpt.ScaleLeft + sngLeftAdjust ' Left inside edge.
sngHeight = rpt.ScaleHeight - (sngHeightAdjust + 0.23) ' Height inside edge.
sngWidth = rpt.ScaleWidth - sngWidthAdjust ' Width inside edge
lngColor = RGB(0, 0, 0) ' Line color
rpt.Line (sngLeft, sngTop)-(sngWidth, sngHeight), lngColor, BF ' Draw line as a box and fill box.

.MoveNext
Loop

End With
rstLines.Close
Set rstLines = Nothing

Exit Sub
Error_Trap:
……
End Sub


"Hmmm, it worked when I tested it....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top