Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Put a border around a MS access report

Posted on 2000-04-09
2
Medium Priority
?
1,065 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 800 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 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