Solved

Put a border around a MS access report

Posted on 2000-04-09
2
980 Views
Last Modified: 2013-11-28
I need to put a border down the sides of a report in access 2000.  The report contains several grouping levels with headers / footers as well as 2 subreports also with headers / footers. Many of the sections contain text boxes or bound object frames and many of the text boxes are set to can grow / shrink. The report sections are also set to can grow / shrink.  I have tried using some simple code to make the borders grow with the sections or text boxes but it doesn't seem to work correctly.
I have tried the following.  

Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
Me!Line1.height = Me!Text1.Height
End Sub

But this example always takes the height of the text box in design view and doesn't allow for the grow / shrink property.


Also i've tried
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Section(acDetail).Height = Me!Line1.height
End Sub

but also with no joy. I have found that the detail section will always go to a standard size for the first record, and then will no resize for subsequnet records. Or if the detial section is part of a subreport then it will work when opened on its own, but will not work when opened as part of the master report.

Does anyone know of a way to make a border automatically size to each section of the report, and at the same time have each section of the report grow / shrink to reduce wasted space.

All comments on this matter would be appreciated.
Thanks
Ian
0
Comment
Question by:ian22
2 Comments
 
LVL 9

Accepted Solution

by:
BrianWren earned 200 total points
ID: 2698572
Is the final result that you want to have continuous lines down the sides of the paper?  If that's the case you could easily draw them  with a ruler and a pen after the report has printed...  (*kidding*) . . .

I haven't actually tried this, but I know that you can use VBA to actually 'draw' on the report.

See 'Line Method' in help for details.

"The Line method draws lines and rectangles on a Report object when the Print event occurs."

I got good results with this adaptation of the example in Help:

Option Compare Database
Option Explicit
_______________________________________________

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    ' Call the Drawline procedure
    DrawLine
End Sub
_______________________________________________

Sub DrawLine()

    Dim sngTop As Single
    Dim sngLeft As Single
    Dim sngWidth As Single
    Dim sngHeight As Single

    Me.ScaleMode = 3                    ' Set scale to pixels.
    sngTop = Me.ScaleTop                ' Top inside edge.
    sngLeft = Me.ScaleLeft + 5          ' Left inside edge.
    sngWidth = Me.ScaleWidth - 10       ' Width inside edge.
    sngHeight = Me.ScaleHeight          ' Height inside edge.

    Me.Line (sngLeft, sngTop)-(sngLeft, sngHeight)          ' Draw line.
    Me.Line (sngWidth, sngTop)-(sngWidth, sngHeight)        ' Draw line.
   'Me.Line (sngTop, sngLeft)-(sngWidth, sngHeight), , B    ' Draw line as a box.
   
End Sub


Brian
0
 

Author Comment

by:ian22
ID: 2705345
Excellent!  Thank you Brian, I've been puzzaling on this one for a week now, and the answer I was looking for was quite straight forward...if you knew where to look

Many thanks
Ian
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question