totn Access

MS Access 2003: Border on a report page

This MSAccess tutorial explains how to print a border on a report page in Access 2003 (with step-by-step instructions).

Question: In Microsoft Access 2003/XP/2000/97, I've created a report and I want to print a border or box around each report page.

Answer: Since the sections of your report can grow or shrink based on the report data, it is difficult to draw a border around a page. Some have tried resizing lines based on the section sizes, etc. But we've found that the easiest way to place a box around each report page is use the Line command.

For example you could paste the following code on to your report's "On Page" event :

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

This code would draw a solid line around the border of the page.

You can modify the border attributes by changing the DrawStyle and DrawWidth in the above code example.