Solved

Put a border around a MS access report

Posted on 2000-04-09
2
1,022 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

628 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