使用矩阵将数据分组,需要添加一个序号显示,实现如下
报表空白处,右击“报表属性”
在属性对话框中,选择代码,输入分组序号相关代码
代码如下
Dim count As Integer
Dim GroupName As String
Public Function GroupCount(name As String) As Integer
If (GroupName = "") Then
count = 1
GroupName = name
GroupCount = count
Exit Function
End If
If (GroupName <> name) Then
count = count + 1
Else
GroupName = name
count = 1
End If
GroupCount = count
End Function
然后在需要显示序号的列,设置表达式,调用分组序号函数
=Code.GroupCount(Fields!MineName.Value) 注:Fields!MineName.Value 是分组字段