Solved

Put a border around a MS access report

Posted on 2000-04-09
2
935 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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now