Dim rs As Recordset
Dim rs2 As Recordset
Dim i As Long
Dim sql As String
sql = "SELECT 人员号ID FROM 人员资料"
Set rs = CurrentDb.OpenRecordset(sql)
Do While Not rs.EOF
Set rs2 = CurrentDb.OpenRecordset("SELECT 人员号ID FROM 人员资料 where 推介人ID = " & rs!人员号ID)
If Not rs2.EOF Then
rs2.MoveFirst
rs2.MoveLast
MsgBox rs2.RecordCount
rs2.Close
End If
rs.MoveNext