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..

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*'

Also you missed the 2nd ' in your code

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.