代码修改后,达到预期效果,再次感谢lin_hailun老师的指教。(前提是要将空白的离厂日期填写为当前日期)
Select Case MainTable.Name
Case "统计"
MainTable.DataTable.DataRows.Clear
Dim dt As DataTable = DataTables("名册")
Dim chejians As List(Of String) = dt.GetUniqueValues("", "车间")
For Each chejian As String In chejians
Dim r As Row = MainTable.AddNew
r("车间") = chejian
r("在册人数") = dt.Compute("count(_Identify)", "进厂日期 <= #8/31/2012# And 离厂日期 > #8/1/2012# And 车间 = '" & chejian & "'")
For i As Integer = 2 To 6
r("技术等级_" & i) = dt.Compute("count(_Identify)", "技术等级 = " & i & " And 车间 = '" & chejian & "'And 进厂日期 <= #8/31/2012# And 离厂日期 > #8/1/2012# ")
Next
Next
End Select
[此贴子已经被作者于2012-11-20 13:12:21编辑过]