Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / January 2006

Tip: Looking for answers? Try searching our database.

Report Border - How do I draw one in VBA?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dennis - 27 Jan 2006 15:31 GMT
I am trying to put a border around my reports; here is the code that I found
in the news group help file.

Me.DrawWidth = 2
Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), B

I am using the below code module to preview my reports, I have over 20
reports so I just call the PreviewThisReport function, from within the form
that I need to preview the report from. Where would I put the above code or
would I have to change the code? Is there an easier way to do it? VBA is some
what new to me. I guess I don’t understand the “Me.” Keyword. Help would be
appreciated.

'function Previews report
Function PreviewThisReport(strReportName As String)

On Error GoTo IsLoaded_Err
   
'find preview report

  DoCmd.OpenReport strReportName, acViewPreview
  DoCmd.RunCommand acCmdFitToWindow
  DoCmd.RunCommand acCmdZoom75
 
Exit Function

IsLoaded_Err:
  Resume Next
   
End Function

Signature

Dennis B

Duane Hookom - 27 Jan 2006 16:39 GMT
The code would normally be placed in the On Page event of each report.

Signature

Duane Hookom
MS Access MVP
--

>I am trying to put a border around my reports; here is the code that I
>found
[quoted text clipped - 31 lines]
>
> End Function
Wayne Morgan - 27 Jan 2006 16:49 GMT
The code would go in the Page event of the report. The help file has the
same example as the one you posted. One thing to be aware of, this will
print the border at the margins (File|Page Setup...) you have set for the
report (not at the edge of the paper). If these margins are outside your
printer's printable area, then the border won't print.

"Me" refers to the module the code is running in. You could say
"Reports!MyReport", but Me is shorter. If you were referring to the report
form somewhere else though, such as from a form, you would have to use the
longer version. You can use Me in any module to refer to the current module.
If that module is a form or report module, you can also use Me as if it
refers to the form or report that the code is running in.

Signature

Wayne Morgan
MS Access MVP

>I am trying to put a border around my reports; here is the code that I
>found
[quoted text clipped - 31 lines]
>
> End Function
Dennis - 27 Jan 2006 17:06 GMT
I put the code in the Page event of the report and it drew a diagonal line
from the left upper corner to the lower right corner of the report. My print
margins are set at .5”. Any idea’s what I’m doing wrong?
Signature

Dennis B

> The code would go in the Page event of the report. The help file has the
> same example as the one you posted. One thing to be aware of, this will
[quoted text clipped - 44 lines]
> >
> > End Function
Duane Hookom - 27 Jan 2006 17:30 GMT
Sorry I missed this but you need to add another comma
Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), , B

Signature

Duane Hookom
MS Access MVP
--

>I put the code in the Page event of the report and it drew a diagonal line
> from the left upper corner to the lower right corner of the report. My
[quoted text clipped - 55 lines]
>> >
>> > End Function
Dennis - 27 Jan 2006 17:47 GMT
That did it Duane, now the only problem I,m having is that it's clipping off
the bottom part of the border, do I have the report page height set to high?

Thanks for the Help!
Signature

Dennis B

> Sorry I missed this but you need to add another comma
> Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), , B
[quoted text clipped - 58 lines]
> >> >
> >> > End Function
Duane Hookom - 27 Jan 2006 18:33 GMT
I can replace the Me.ScaleHeight with another number of expression.

Signature

Duane Hookom
MS Access MVP
--

> That did it Duane, now the only problem I,m having is that it's clipping
> off
[quoted text clipped - 75 lines]
>> >> >
>> >> > End Function
Marshall Barton - 27 Jan 2006 20:53 GMT
>That did it Duane, now the only problem I,m having is that it's clipping off
>the bottom part of the border, do I have the report page height set to high?
Just subtract a small amount from the height in the line
method:

Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight - 30), , B

Signature

Marsh
MVP [MS Access]

Dennis - 27 Jan 2006 22:23 GMT
Marshall

That did it.

Thanks Much!
Signature

Dennis B

> >That did it Duane, now the only problem I,m having is that it's clipping off
> >the bottom part of the border, do I have the report page height set to high?
> Just subtract a small amount from the height in the line
> method:
>
> Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight - 30), , B
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.