Others

How to Extend Detail Lines to Page Footer in MS Access Reports

Chanuka GeekiyanageChanuka Geekiyanage Nov 2, 2026 870 views

Question details

The user wants to draw vertical separator lines in an Access report that stretch completely from the detail section to the page footer, regardless of the number of detail records.

How to Extend Detail Lines to the Page Footer in Access Reports
Product
Microsoft Access
Device & OS
not provided
Scenario
Formatting a database report where the number of detail records fluctuates, but the layout requires continuous vertical lines extending to the bottom of the page.
Observed behavior
By default, vertical lines drawn in the detail section stop rendering after the last record, leaving a blank gap before the page footer.
Before you start

Verify the exact section indices for your Report Header and Page Header in the report's design view, as these properties are required to calculate the correct starting coordinates for your lines.

Solution 1Recommended

Use the VBA Line Method in the On Page Event

Instead of using the Detail section's On Format event, place the Line method in the report's On Page event to draw a line across the entire remaining page space.

The Detail section only renders for the exact height of the existing records. By moving the drawing logic to the On Page event, you instruct Access to draw the vertical line after the page layout is calculated, extending it all the way to the maximum vertical coordinate (twips).

1
Open Report in Design View

Right-click your report in the Navigation Pane and select 'Design View'.

2
Access the On Page Event

Open the Property Sheet (F4), ensure the selection type is 'Report', go to the 'Event' tab, and locate the 'On Page' property.

3
Open the VBA Editor

Click the builder button (...) next to 'On Page' and choose 'Code Builder' to open the VBA editor.

4
Insert the Line Method Code

Add the following code to calculate the headers and draw the line: Private Sub Report_Page() Dim reportHeaderHeight As Long Dim pageHeaderHeight As Long reportHeaderHeight = Me.Section(1).Height pageHeaderHeight = Me.Section(4).Height Me.Line (0, reportHeaderHeight + pageHeaderHeight)-(0, 32767) End Sub

5
Preview the Report

Save your VBA code, close the editor, and switch the report to 'Print Preview' to verify that the vertical line extends seamlessly into the footer.

Use the VBA Line Method in the On Page Event
Coordinate Adjustments: The '0' in the Me.Line coordinates represents the far-left edge. Change this horizontal coordinate to match the exact placement where your separator line should appear.
Free Microsoft Office alternative

Looking for a Lightweight and Free Office Suite?

Microsoft Access is built for complex databases, but if you're managing standard data and reports, WPS Office provides a free, lightweight, and incredibly intuitive alternative to Microsoft Office. It covers all essential spreadsheet, document, and presentation needs without the heavy resource usage.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installation package for your operating system.
  2. 2. Export Data from Access: If you are transitioning away from Access, export your tables and queries to standard Excel (.xlsx) formats.
  3. 3. Manage Data in WPS Spreadsheet: Open your exported files in WPS Spreadsheet to easily format, report, and print your data without needing complex VBA coding.
Highly compatible with Microsoft Excel formats (.xlsx, .xls, .csv) for straightforward data management and reporting.Familiar ribbon interface ensures zero learning curve when migrating from Microsoft Office.All-in-one lightweight application combining Writer, Spreadsheet, Presentation, and PDF tools.Free to use with built-in cloud support for easy team collaboration.
microsoft office alternative - wps office

Frequently Asked Questions

Why do lines in the Detail section of an Access report cut off early?

By default, the Detail section only renders for the exact height of the records present. If there are few records on the last page, the Detail section ends early, leaving a blank space above the footer.

What does the 32767 coordinate mean in the VBA Line method?

The value 32767 represents the maximum logical bottom coordinate measured in twips for a Microsoft Access report page. Using this value ensures the line stretches to the absolute top boundary of the page footer.

Can I use the On Format event instead of On Page to draw the lines?

No, because the On Format event triggers strictly per record. This means the line will only draw as long as the records themselves. To draw continuous lines in the empty space below the records, you must use the On Page event.