Report.FormatCount 属性 (Access)
使用 FormatCount 属性可确定已针对报表的当前部分评估 OnFormat 属性的次数。 Integer 型,可读/写。
语法
表达式。FormatCount
表达 一个代表 Report 对象的变量。
备注
仅在节的 OnFormat 属性设置指定的事件过程中使用此属性。
该属性在报表设计视图中不可用。
Microsoft Access 将当前节的 OnFormat 属性设置为计算每次递增的 FormatCount 属性。 按照下一节的格式设置,则 Microsoft Access 将 FormatCount 属性重置为 1。
在某些情况下,Microsoft Access 将节格式设置超过一次。 例如,您可以设计的报表的主体节的 区长 属性设为是。 当 Microsoft Access 到达页面的底部时,它格式化当前主体节一旦看到如果它将适合。 如果它不适合的 Microsoft Access 将移动到下一个页面,并再次设置主体节的格式。 在这种情况下,主体节的 FormatCount 属性的设置为 2,因为它不格式化两次,才能打印。
使用 FormatCount 属性可确保对分区仅执行一次影响格式设置的操作。
示例
在以下示例中,仅当 FormatCount 属性设置为 1 时,才计算 DLookup 函数。
Private Sub Detail_Format(Cancel As Integer, _
FormatCount As Integer)
Const conBold = 700
Const conNormal = 400
If FormatCount = 1 Then
If DLookup("CompanyName", _
"Customers", "CustomerID = Reports!" _
& "[Customer Labels]!CustomerID") _
Like "B*" Then
CompanyNameLine.FontWeight = conBold
Else
CompanyNameLine.FontWeight = conNormal
End If
End If
End Sub
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。