Why can't I use the Like Predicate
Posted on 1998-07-22
I'm using ADO to connect to an Access 95 database through a DSN. The problem is I have SQL statement similar to the following
SELECT * FROM [Table] WHERE [FieldName] Like('*" & FieldValue & "*') ORDER BY [FieldName2]
Now there is nothing wrong with the SQL string because if I go into Access and put this as a query it returns the correct records. The problem is when I run the following line:
rs.Open sSQL, "DSN=Town;uid=;pwd=", adOpenForwardOnly, adLockReadOnly
I get this error:
Expression cannot be used with the Like predicate. in query expression '[Owner] alike('*Name*')'.