把开始查询的代码改为 Set DataGrid1.DataSource = adocustomer = adCmdText adocustomer.RecordSource = "select * from customer where 姓名 like '% " & txtfirname.Text & "%'" adocustomer.Refresh If adocustomer.Recordset.BOF = False Then MsgBox "该客户不存在!", vbOKOnly, "提示" End If If txtfirname.Text = "" Then MsgBox "请输入查询姓氏!", vbOKOnly, "提示" End If