Drawing lines on a report.

daveWP

Registered User.
Local time
Today, 07:01
Joined
Sep 18, 2009
Messages
28
Hi experts, please help.

I'm trying to draw a solid line on the left page border and the right page border both ending at the bottom of the Detail Section (or top of the page footer if you will).

I'm finding lots of resources on drawling a rectangle around the entire page, but not this. I don't know anything about VBA.

I'm using Access 2003.

Any help would be greatly appreciated.
 
Just an idea.
Place a textbox at the top of the footer bound to a field of multiple underscores: ___________________________________________
 
multiple underscores? What do you mean?
 
In the same key as the hyphen but with Shift. _ _ _ _____________________
 
You have any ideas on passing the variable size of the detail section to the field?
 
There is a line and it shows on the tool box at an angle, like a forward slash on the key board. When you drag it to the form it can then be moved from horizontal through to the vertical.
 
If you still want to draw the lines: -

Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    Dim lngLeftOffset  As Long
    Dim lngRightOffset As Long
    
    [color=green]' Just in case you need offsets.[/color]
    lngLeftOffset = 0
    lngRightOffset = 0

    [color=green]' Left vertical line.[/color]
    Me.Line (Me.ScaleLeft + lngLeftOffset, Me.ScaleTop)-(Me.ScaleLeft + lngLeftOffset, Me.ScaleHeight), vbBlack
    
    [color=green]' Right vertical line.[/color]
    Me.Line (Me.ScaleWidth - lngRightOffset, Me.ScaleTop)-(Me.ScaleWidth - lngRightOffset, Me.ScaleHeight), vbBlack

End Sub
 
There is a line and it shows on the tool box at an angle.

I saw that in my A2007. Assumed it must have been a new feature for 2007 or would have been seen by the OP. But maybe not. After using 2007 for a while I can't remember what the earlier versions looked like. Surprising how quickly the neurons move on.:D

I like the code supplied by ChrisO.
 
ChrisO,
I'm trying to work with your code, but can't seem to get it to get exactly what I want, which is frustrating.

What I've noticed is that your code draws a line on the right and left side of the detail section, which is great but it seems to fire before any of the text boxes or the subreport grows. So the lines assume the natural length of the detail section from design view.

Do you or anyone have any other ideas?
 
Try fixing the line height to maximum: -

Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    Dim lngLeftOffset  As Long
    Dim lngRightOffset As Long
    
    Const conMaxHeight As Integer = 32767
    
    [color=green]' Just in case you need offsets.[/color]
    lngLeftOffset = 0
    lngRightOffset = 0

    [color=green]' Left vertical line.[/color]
    Me.Line (Me.ScaleLeft + lngLeftOffset, Me.ScaleTop)-(Me.ScaleLeft + lngLeftOffset, conMaxHeight), vbBlack
    
    [color=green]' Right vertical line.[/color]
    Me.Line (Me.ScaleWidth - lngRightOffset, Me.ScaleTop)-(Me.ScaleWidth - lngRightOffset, conMaxHeight), vbBlack

End Sub
 
That worked!

Thanks Chris, and all who have helped me.

You guys are helping a nub find his way!
 
I know this has been sorted now but, when im drawing lines on a report, i just use the rectangle tool and then size it down so it is only a single line
 

Users who are viewing this thread

Back
Top Bottom