以下是引用狐狸爸爸在2009-7-28 21:05:00的发言:
没有看懂,不过交叉统计本来就只包括筛选出来的数据嘛,为啥不用呢?
楼主要在统计表中固定一些列,来达到统计的结果。也不知道筛选后会有几个产品被筛选出来的~
楼主你在“产品表”做个按钮,在你筛选完后(要排除重复内容),点击这个按钮 代码: 试一试吧
(注意:与数字计算有关的列要改为整数型(或其他数字型),统计表中产品A的列名为‘A ’,列标题为‘产品A’,其他列亦同)
DataTables("统计表").DataRows.Clear()
for i as Integer = 0 to tables("产品表").count -1
Dim dr As DataRow
dr = DataTables("统计表").AddNew()
dr("医生") = currenttable(i,"医生")
next
MainTable = Tables("统计表")
for i as Integer = 0 to tables("统计表").count -1
For Each cl As Col In tables("统计表").Cols
if cl.name <> "日期" and cl.name <> "医生"
currenttable(i,cl.name)= DataTables("产品表").Compute("Sum(数量)", "产品 = '" & cl.name & "'and 医生 = '" & currenttable(i,"医生") & "' ")
end if
Next
Next
[此贴子已经被作者于2009-7-28 22:32:00编辑过]