您好!
利用下面的代码试试
Dim aa As Integer
Private Sub DataGrid1_Click()
aa = 0
Text1.Text = Adodc1.Recordset.Fields("学生姓名")
Adodc1.RecordSource = "select * from tb_stu"
Adodc1.Refresh
For i = 0 To Adodc1.Recordset.RecordCount - 1
aa = aa + 1
If Adodc1.Recordset.Fields("学生姓名") = Text1.Text Then Exit For
Adodc1.Recordset.MoveNext
Next i
MsgBox aa
End Sub