I want to have a border around the entire Detail section of a report that shrinks and grows based on the data. I found the Draw Line VBA but am not sure how to make it specific to the Detail section. (I don't have a "Notes" field.) I attached a sample DB with the VBA in it. The VBA is in the Event tab, Detail, On Print command.
Any direction would be much appreciated.
Line Around Detail.zip
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim X1 As Single, Y1 As Single
Dim X2 As Single, Y2 As Single
Dim Offset As Single
Dim Color As Long
'Specify unit of measurement for coordinates on a page.
Me.ScaleMode = 1 'Twips (1440 twips = 1 inch).
'Define an offset of 1/8 inch from the text box to the rectangle.
Offset = 1440 / 8
'X and Y coordinates for the top left corner of the box.
X1 = Me![Notes].Left - Offset
Y1 = Me![Notes].Top - Offset
'X and Y coordinates for the bottom right corner of the box.
X2 = Me![Notes].Left + Me![Notes].Width + Offset
Y2 = Me![Notes].Top + Me![Notes].Height + Offset
Me.DrawWidth = 3 'Width of the line (in pixels).
Color = RGB(0, 0, 0) 'Use black line color.
'Draw the rectangle with the Line method.
Me.Line (X1, Y1)-(X2, Y2), Color, B
End Sub