How to Extend Detail Lines to Page Footer in MS Access Reports
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.

- 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.
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.
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).
Right-click your report in the Navigation Pane and select 'Design View'.
Open the Property Sheet (F4), ensure the selection type is 'Report', go to the 'Event' tab, and locate the 'On Page' property.
Click the builder button (...) next to 'On Page' and choose 'Code Builder' to open the VBA editor.
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
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.

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. Download WPS Office: Visit the official WPS website and download the free installation package for your operating system.
- 2. Export Data from Access: If you are transitioning away from Access, export your tables and queries to standard Excel (.xlsx) formats.
- 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.

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.




