做个修改试试:(用ADODB来实现,因为DATA控件太不好用)
Private Sub cmsearch_Click()
Dim prompt As String
Dim SQL As String
Dim rst As ADODB.RecordSet
Dim Con As ADODB.Connection
prompt=InputBox("输入完整姓名","查找姓名")
Set Con=new ADODB.Connection
Con.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=数据库路径"
Con.Open
Set rst=new ADODB.RecordSet
SQL="select * from 表名 where 字段名='" & prompt & "'"
rst.Open SQL,Con,1,3
If rst.EOF=false and rst.BOF=false Then
执行找到记录的操作
Else
MsgBox "对不起,不能发现要查找的姓名",VbInfomation,"提示"
End If
rst.close
Con.close
set rst=nothing
set Con=nothing
End Sub