substring search in access

J

JavaGuru

Hey,
I want to do a substring search in a database, and access complains about
the query being too complex, can somebody help ? this is the code :

SELECT *
FROM MOVIES
WHERE InStr(MOVIES.name)=@PARAM
ORDER BY MOVIES.name;
 
D

Dan Artuso

Hi,
That's not the correct syntax for InStr.
Returns a Variant (Long) specifying the position of the first occurrence of one string within another.
InStr([start, ]string1, string2[, compare])

' A textual comparison starting at position 4. Returns 6.
MyPos = Instr(4, SearchString, SearchChar, 1)

Look it up in Help for more info.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top