小弟刚学VB,请高手帮我看下,下面的程序有什么错误,为什么实现不了我的查找功能

来源:百度知道 编辑:UC知道 时间:2024/07/05 07:29:17
Private Sub Comfind_Click()
If Combo1.Text = "员工编号" Then

Adodc1.RecordSource = "select*from gsyg where(ygid like 'text1(0).text%')"
Else
Adodc1.RecordSource = "select*from gsyg where(ygname like 'text1(0).text%')"
End If
Adodc1.Recordset.Update
Adodc1.Recordset.Requery
End Sub
刚才这个朋友的答复,我试过,编译时通不过的。
'" + Text1(0).Text + "'+'%'
这样如何?

"select*from gsyg where(ygid like 'text1(0).text%')"
错了
"select*from gsyg where(ygid like '" &text1(0).text& "%')"
这样就好 下面也是
你的text zai ""里面无法识别
-----------------------------------------------
不是吧 我记得应该是这样 抱什么错误?

"select*from gsyg where(ygid like '" &text1(0).text& "%')"

试试把这个改成"select*from gsyg where(ygid like '" & text1(0).text & "%')"

楼上的,空格有时候是不可以省略的