0

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.

2
Contributors
3
Replies
11
Views
3 Years
Discussion Span
Last Post by Sushma Somesh
0

Try

rec.Open "select * from Body_Markings_new where [Part Number] like '%" & txtsearch.Text & "%' ", conn, adOpenDynamic, adLockOptimistic

It's my own preference, but I always avoid putting spaces in field names. It always leads to problems like this.

Edited by Reverend Jim

0

Hi Jim,
It works, thanks a lot for your help.
Ofcourse I tried without spacce also, it was not worked. After placeing square brackets it works.

0

Hi Jim,
I have one more issue..

tht after searching part number in datagrid, it will display the searched item in same datagrid. After tht i want to refresh the datagrid with completely.

can you please help me on this.

Sushma.s

This question has already been answered. 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.