Do While olerd.read()
For i = 0 To olerd.fieldcount - 1
If Trim(TextBox1.Text) = (olerd.item("ID")) And Trim(TextBox2.Text) = (olerd.item("MIMA")) Then
MsgBox("成功登陆")
pd = True
Exit Sub
End If
Next
Loop
TextBox1.Text = ""
TextBox2.Text = ""
TextBox1.Focus()
olerd.close()
olecn.close()
这个方法就可以了,如果为空就让textbox。focus()exitsub