Aducci
Aducci

Reputation: 26694

Force Report Footer to be at bottom of page

In Microsoft Access 2007,

Is there a way to display the Report Footer section at the bottom of the last page? Right now my Report Footer section always follows my Detail section, so it ends up anywhere.

I would like to avoid using VBA as much as possible.

Upvotes: 3

Views: 16281

Answers (2)

BIBD
BIBD

Reputation: 15414

I found a better way here - you can have a large report footer that doesn't eat half the space on your page for the Details section

Basically you need to add the following code to your report (although you could put it in a common module):

Sub SetGrpFtrLoc(Rpt As Report, GrpFtrLoc As Double)
    GrpFtrLoc = GrpFtrLoc * 1440        'Convert from inches to twips.
    If Rpt.Top < GrpFtrLoc Then         'Not at location yet, so
        Rpt.MoveLayout = True           'move to next print location.
        Rpt.NextRecord = False          'Do not go to next record.
        Rpt.PrintSection = False        'Do not print the section.
    End If                              'Until the required offset is reached
End Sub

You can then put the following in an Event Procedure for the Report Footer's On Format.

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    Call SetGrpFtrLoc(Me.Report, 8)     'Display report footer at least
                                        '8 inches from the top of the page
End Sub

(MS's example made SetGrpFtrLoc a function and called it directly in the Report Footer's On Format event, in my case I needed to do other things in the On Format event, so I made it into a Sub)

Upvotes: 2

Fionnuala
Fionnuala

Reputation: 91376

Does it have to be the report footer, or is the requirement that you wish text to appear at the bottom of the page on the last page of the report? If so, then it can be done with very little VBA:

Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
If Page = Pages Then
   Me.[TextBoxName].Visible = True
Else
   Me.[TextBoxName].Visible = False
End If
End Sub

The idea is that you place a textbox in the page footer and only make it visible on the last page.

In addition, you may wish to read http://support.microsoft.com/kb/208979/en-us

Upvotes: 3

Related Questions