Solved

Put a border around a MS access report

Posted on 2000-04-09
2
968 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

776 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