MS Access Report - How to draw a border on a report

Hi Experts,

I have a completed report that I would like to add a border around.  It has a Header and detail section.  This is a Certificate, so one page per.

How do I do this?

Thanks for helping.
Amour22015Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike EghtebasDatabase and Application DeveloperCommented:
In the detail section, have a vertical line. in both left and right sides. Click on details (in design view) to see what its height is, make these lines the same height.
Also, add two horizontal lines on the very top and bottom of your report.
0
IrogSintaCommented:
Just to add.  The horizontal lines need to be in the Page Header and Page Footer sections and not in the Report Header and Footer sections.  If you add any Group sections, these will also need horizontal lines similar to your Detail section.

Ron
0
Amour22015Author Commented:
I looked this up on google it is mentioned to create a new report, use the rectangle transparent the back style then bring in the finished report as a subreport.  Is this correct?

Thanks
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

IrogSintaCommented:
Either way will work.

Ron
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
There are a couple of different approaches to this:

1. In the On Page event, draw the border.  Lebans has a nice class for this:

http://www.lebans.com/PrintLines.htm

 If you don't want to use the class for some reason, this is how you would actually draw it:

Private Sub Report_Page()

Me.DrawStyle = 0
Me.DrawWidth = 11

' Draw a border around the page.
Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), , B

End Sub

 OnPage is the last event to fire before the page is printed.

2. Do it in the Page header as shown in this EE article:

http://www.experts-exchange.com/articles/8911/How-to-underlay-a-section-in-Microsoft-Access-Reports.html

Jim.
0
Amour22015Author Commented:
Now can you have a subreport within a subreport creating a new report to bring in?

I tried and noticed that the header part is missing.


On my original report (without the border) I have a header (this is a subreport that has a logo)  and the detail section and then I am creating a new report to draw the border and taking the original (no border) as a subreport to the newly created report that has the border.  Jim it seems I don't need that much detail and would not be using vba for this.

Thanks for helping me.
0
IrogSintaCommented:
@Jim, using the OnPage event for this is pretty cool.  I think I'll use this from now on.

Ron
0
Amour22015Author Commented:
maybe I don't understand what @jim is saying?  Please explain step by step  Thanks,
0
Amour22015Author Commented:
So jim what you are saying is to keep the original and add the vba code?  This will bring up a border?  I will need a solid line like 5 pt and then another solid line like 1 pt it is a double line border.

Please help and step by step so that I understand...
0
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<Please help and step by step so that I understand... >>

 In general, borders on a page are best done at the page level.  While you certainly can do it as Ron first showed, it can be a bit finicky to do as you need to get everything lined up right (it's easy to get gaps) and is problematic with sections that can grow and shrink.

The old tried and true method was to draw lines using VBA in the OnPrint event.  This event occurs when the page is fully rendered and is ready to print.   There's a lot of things you can't to in that event, but drawing lines is one of them.

 All the text, graphics, etc are already on the "page", so these lines get drawn on top of that.   Fundamentally, what you do is draw a line:

Me.DrawStyle = 0
Me.DrawWidth = 11

' Draw a border around the page.
Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), , B

Leban's PrintLine class makes it easy and gives you the ability to do more things.   You just call methods and get lines and/or borders around stuff.  But if you haven't used classes before, then you may be more comfortable using the above code in the OnPage event.

What also has come to light is that if you wish, you can do this from the page header event as well.    That is what was in the EE article (last link I gave you).  

 But the process is the reverse; your lines are laid down on the page first, then everything else on top of that.

 In the end if your drawing borders, the net effect is the same and will look the same, so you can do it either way.

 I would start with Ron's method and if that gives you what you want, then great.    If not, then you can:

1. Draw the lines yourself in the OnPage event
2. Drop Leban's PrintLine class into your app and use that.
3. Follow the article and draw the lines in the Page Header

Jim.
0
Amour22015Author Commented:
So I am trying Jim's posting on:

Private Sub Report_Page()
Me.DrawStyle = 1
Me.DrawWidth = 30

' Draw a border around the page.
Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), , B

End Sub

But will need more info on this?

I want it to be a double line with the first one as like 5 pt and the other like 1 pt one right next to the other. also I noticed that there is like a pitch to the line which I do not want.  I guess playing with this would work.

Thanks for helping me...
0
Amour22015Author Commented:
Jim I tried:
http://www.lebans.com/PrintLines.htm

It did nothing, there was nothing to go by, I even tried the links to this and came up with error's saying that it was a read only and would not open.   There was very little to go on and did not even have a topic on what I am looking for:

This is all it says:

PrintLinesClass - Create Vertical lines, Borders and boxes with the addition of a simple to use Class to your project. PrintLinesClassA97      or PrintLinesClass2K

Draw Borders around individual Sections of your Report.
Draw Vertical Lines  in individual Sections of your Report.
Specify DrawWidth, DrawStyle, DrawMode and Line Color for each individual Section.
Use Intellisense to set the Section Properties.
Correctly handles CanGrow and KeepTogether properties for the Report Sections and individual Controls.

 

PrintLines is the older version that demonstates several methods not found in the PrintLinesClass project.

PrintLinesA97 - Create Vertical lines, Borders and boxes with VBA code.

New Ver 19 January 20, 2002. Added support for vertically centering the contents of a TextBox or Label control.

How to create a margin for your TextBox.
How to Draw Vertical lines the entire vertical length of your Report.
How to Draw a Grid.
How to force the contents of a Memo field to fit within a fixed sized control.
Lots of other stuff!


So what you are saying is to draw the lines and then put the sub in the VBA code?

Thanks
0
Amour22015Author Commented:
I guess this does not work trying to do a double line border?

Thanks for helping....
0
Amour22015Author Commented:
Yes looks like all I have to do is draw a  rectangle around the original report.

Thanks....
0
Amour22015Author Commented:
Thanks for helping
0
IrogSintaCommented:
Here's the code you would use to a draw a double border with the outside border being thicker than the inside one:
    Me.DrawStyle = 0
    
    'Thick outside border
    Me.DrawWidth = 30
    Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), , B
    
    'Thin inside border
    Me.DrawWidth = 15
    Me.Line (100, 100)-(Me.ScaleWidth - 100, Me.ScaleHeight - 100), , B

Open in new window

For more info on the Line drawing method, check this link:
https://msdn.microsoft.com/en-us/library/office/ff198297.aspx

Ron
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.