读书人

请问标准表达式中数据类型不匹配的有关

发布时间: 2012-04-19 14:36:43 作者: rapoo

请教标准表达式中数据类型不匹配的问题
如图


If Check1.Value Then
scp = " and " & Combo2.Text & " = " & Text1.Text & ""
Else
scp = ""
End If
Dim scp1 As String

If Check2.Value Then
scp1 = " and " & Combo3.Text & " = " & Text2.Text & ""
Else
scp1 = ""
End If

SQL = "select * from " & Combo1.Text & " where 1=1 " & scp & scp1

执行后,错误提示标准表达式中数据类型不匹配
查看数据库内数据类型都是文本,请教什么原因

[解决办法]
If Check1.Value Then
scp = " and " & Combo2.Text & " = '" & Text1.Text & "'"
Else
scp = ""
End If
Dim scp1 As String

If Check2.Value Then
scp1 = " and " & Combo3.Text & " = '" & Text2.Text & "'"
Else
scp1 = ""
End If

SQL = "select * from " & Combo1.Text & " where 1=1 " & scp & scp1

读书人网 >VB

热点推荐