http://www.foxtable.com/webhelp/topics/2925.htm、http://www.foxtable.com/webhelp/topics/0604.htm
不要搞那么复杂
Select Case e.DataCol.name
Case "岗位"
Dim count As Integer = DataTables("员工花名册").Compute("count(姓名)", "企业名称 = '" & e.DataRow("企业名称") & "' And 现所在单位 = '" & e.DataRow("部门") & "' And (岗位 = '" & e.DataRow("岗位") & "' or 其他岗位 = '" & e.DataRow("岗位") & ")")
If count > 0 Then
e.DataRow("人数") = count
Else
e.DataRow("人数") = Nothing
End If
End Select
可以了。谢谢蓝老师指点。
Select Case e.DataCol.name
Case "岗位"
Dim count As Integer = DataTables("员工花名册").Compute("count(姓名)", "(企业名称 = '" & e.DataRow("企业名称") & "' And 现所在单位 = '" & e.DataRow("部门") & "' And 岗位 = '" & e.DataRow("岗位") & "' and 其他岗位 is null and 员工状态 = '在岗') or (企业名称 = '" & e.DataRow("企业名称") & "' and 其他岗位 is not null And 其他岗位 = '" & e.DataRow("岗位") & "' and 员工状态 = '在岗')")
If count > = 0 Then
e.DataRow("人数") = count
End If
End Select