然后你自己做一个查询,得出这个表里的平均值
Sub aExcuteEvents()
CurrentProject.Connection.Execute "delete * from tblcalfliter"
Dim rsyg As New ADODB.Recordset
rsyg.Open "qrykxcount", CurrentProject.Connection, 1, 2
Do While Not rsyg.EOF
goFindrec rsyg("被考核人员"), rsyg("考项"), "中层", "tblCalFliter"
rsyg.MoveNext
Loop
End Sub
Sub goFindrec(strXm As String, strKx As String, TblName As String, AddSql As String)
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Dim rs5 As New ADODB.Recordset
Dim rs6 As New ADODB.Recordset
Dim rs7 As New ADODB.Recordset
Dim rs8 As New ADODB.Recordset
Dim rs9 As New ADODB.Recordset
Dim fld(9) As String
Dim sql(9) As String
fld(0) = "工作责任心"
fld(1) = "敬业精神"
fld(2) = "执行力度"
fld(3) = "积极主动"
fld(4) = "办事公道"
fld(5) = "廉洁自律"
fld(6) = "创新精神"
fld(7) = "全局观念"
fld(8) = "团结协作意识"
fld(9) = "工作能力及方法"
Dim strCri As String
strCri = "[被考核人员]='" & strXm & "' and [考项]='" & strKx & "'"
Debug.Print strCri
Dim intKxCount As Integer
intKxCount = DCount("考项", "中层", strCri)
Debug.Print "被考核人员的考项数:" & intKxCount
sql(0) = "select " & fld(0) & " from " & TblName & " where " & strCri & " order by " & fld(0)
sql(1) = "select " & fld(1) & " from " & TblName & " where " & strCri & " order by " & fld(1)
sql(2) = "select " & fld(2) & " from " & TblName & " where " & strCri & " order by " & fld(2)
sql(3) = "select " & fld(3) & " from " & TblName & " where " & strCri & " order by " & fld(3)
sql(4) = "select " & fld(4) & " from " & TblName & " where " & strCri & " order by " & fld(4)
sql(5) = "select " & fld(5) & " from " & TblName & " where " & strCri & " order by " & fld(5)
sql(6) = "select " & fld(6) & " from " & TblName & " where " & strCri & " order by " & fld(6)
sql(7) = "select " & fld(7) & " from " & TblName & " where " & strCri & " order by " & fld(7)
sql(8) = "select " & fld(8) & " from " & TblName & " where " & strCri & " order by " & fld(8)
sql(9) = "select " & fld(9) & " from " & TblName & " where " & strCri & " order by " & fld(9)
Select Case intKxCount
Case Is <= 19
j = 0
Case Is <= 39
j = 1
Case Is <= 59
j = 2
Case Is <= 79
j = 3
Case Is > 79
j = 4
End Select
Debug.Print "筛除记录数:" & j & "×2"