Searching a database - code review needed

First do your queries - until they work - directly on the database with an SQLite application. Secondly, use SmartSQL to build your queries. I have to check tomorrow where I got that. From This is a great help when building more complex SQL.

Thanks everyone - I think I now have it working, I am just a bit lost about not needing the last if statement as advised by Jym?

When is the last word not going to be AND ? For me no sense in testing to see if you know it’s always going to be AND; just get rid of it. But if there’s some way for it not to equal AND then include the IF.

Ahhhh - you meant keep the actual Search = left(Search,len(Search)-5) and just remove the surrounding if statement.
I thought you meant remove the entire code segment :slight_smile:

Thank you so much for all your help!
Much appreciated.