0

Hello

Every time i input the character ' and % in the textfield it generate an error in my query.

The error:
Syntax error in query expression 'Title LIKE '%' %%';'.

My code:

adoList.Open "SELECT * FROM qryOPAC WHERE Title LIKE '%" & varExp & "%';",CoNN,3,3

tnx in advance..

4
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by werks
0

The wildcard characters can be different depending on what database in use.

Try using the * character and see if it works better. Also try to set a static value and and see if you get any results from the database as WHERE Title LIKE '%someword%'
or
WHERE Title LIKE '*someword*'

0

The reason why it is coming up this way is that varexp is set to this:

' %

check what varexp's value is and make sure you have NO quotes in there whatsoever, as well as % signs.

0

Thanks for your reply. I just found out how to manage that by using Replace() function.. btw thanks everybody

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.