0

Does anyone know the exact query for IN in the following senario...

I want to search for 2 columns for 1 mobile number (mobile, alternate mobile)

I am using the following query

strSQL = "select * from tblcontest where bar_mob_no IN('" & sSQL &"') or bar_alt_mob in('" & sSQL &"')"

But its hshowing the following error

Microsoft JET Database Engine- Error '80040e14'

Syntax error (missing operator) in query expression 'bar_mob_no IN(''44444444'') or bar_alt_mob in(''44444444'')'.
2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by noman78
0

he syntax should be this
"select * from tbl_name where mobile_no in ('firstvalue','secondvalue')"
what i think
the expression which you are creating for search criteria, i mean,"SSql"
should contain single quotes and you should remove ingle uotes from query
i mean
instead of
strSQL = "select * from tblcontest where bar_mob_no IN('" & sSQL &"') or bar_alt_mob in('" & sSQL &"')"

use this
strSQL = "select * from tblcontest where bar_mob_no IN(" & sSQL &") or bar_alt_mob in(" & sSQL &")"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.