423,680 Members | 2,394 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,680 IT Pros & Developers. It's quick & easy.

Getting an error saying syntax error (missing operator) in query expression

P: 1
HI,
my code for search is
rec.Open "select * from Body_Markings_new where Part Number like '%" & txtsearch.Text & "%' ", conn, adOpenDynamic, adLockOptimistic

after compiling this code getting an error saying syntax error (missing operator) in query expression 'part number like' %1%"

please help me I not able to fix this.
May 6 '14 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,272
You should avoid spaces in object names. If you're going to use them, then you have to tell the SQL that the two separate words are one thing but demarcating them as such. That will depend on which DBMS you're using. In SQL Server, you use square brackets [ ]. In MySQL, you use ticks ` `.
May 6 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.