【问题标题】:Force Report Footer to be at bottom of page强制报告页脚位于页面底部
【发布时间】:2012-01-23 21:52:32
【问题描述】:

在 Microsoft Access 2007 中,

有没有办法在最后一页的底部显示报告页脚部分?现在我的报告页脚部分总是在我的细节部分之后,所以它会在任何地方结束。

我想尽可能避免使用 VBA。

【问题讨论】:

    标签: ms-access ms-access-2007 report


    【解决方案1】:

    它必须是报表页脚,还是要求文本出现在报表最后一页的页面底部?如果是这样,那么只需很少的 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
    

    这个想法是你在页脚中放置一个文本框,并且只让它在最后一页上可见。

    另外,您不妨阅读http://support.microsoft.com/kb/208979/en-us

    【讨论】:

    • 不利的是,当 TextBoxName 不可见时,会扩大页脚的大小(并且无法缩小)。
    【解决方案2】:

    我找到了一个更好的方法here - 你可以有一个大的报表页脚,它不会占用页面上一半空间的详细信息部分

    基本上您需要将以下代码添加到您的报告中(尽管您可以将它放在一个通用模块中):

    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
    

    然后,您可以将以下内容放入报表页脚的 On 格式的事件过程中。

    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的例子把SetGrpFtrLoc做成了一个函数,直接在Report Footer的On Format事件中调用,在我的例子中我需要在On Format事件中做其他事情,所以我把它做成了一个Sub)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-05
      • 1970-01-01
      相关资源
      最近更新 更多