关于VB中在查询中使用控件......
大家好:小弟是潜水很长时间的菜鸟......
请教前辈们一个问题:
我做了一个查询窗体,有两个comboBox,一个保存关键字(比如“序号”),另一个保存比较运算符(比如“like","<")。
Select Case Combo2.Text
Case Is = "like"
Data1.RecordSource = "select * from gzb where (gzb." & Combo1.Text & " " & "like " + Chr(34) + "*" + Text1.Text + "*" + Chr(34) + ")"
Case Is = "="
Data1.RecordSource = "select * from gzb where (gzb." & Combo1.Text & " " & "like " + Chr(34) + Text1.Text + Chr(34) + ")"
Case Is = ">"
Data1.RecordSource = "select * from gzb where (gzb." & Combo1.Text & " " & "like " + Chr(34) + Text1.Text + "*" + Chr(34) + ")"
Case Is = "<"
Data1.RecordSource = "select * from gzb where (gzb." & Combo1.Text & " " & "like " + Chr(34) + "*" + Text1.Text + Chr(34) + ")"
上面的代码有错误
不管选什么运算符,都是按like来的, 不应该都是like运算符,由于小弟有些菜得过分,请前辈们说得详细些......
还请详细说一下比如
Data1.RecordSource = "select * from gzb where (gzb." & Combo1.Text & " " & "like " + Chr(34) + Text1.Text + "*" + Chr(34) + ")"
里面各个组成的具体意思,有可能的话,尽量详细点。
给大家添麻烦了,谢谢!!!