I am using a VB6 Enterprise Edition, and I am accesing an MS Access database using MS Jet 4.0...
How can I use the LIKE query? If I can't, how can I search a database for a substring instead of the whole data in the record?
Printable View
I am using a VB6 Enterprise Edition, and I am accesing an MS Access database using MS Jet 4.0...
How can I use the LIKE query? If I can't, how can I search a database for a substring instead of the whole data in the record?
LIKE is used instead of = in the WHERE clause and use it with wildcards. The most common wildcards are * and ?.Quote:
Originally Posted by bulletrick
Examples:
This query returns all rows where MyColumn begins with bulletrick.Code:select * from MyTable where MyColumn like 'bulletrick*'
This query returns all rows where MyColumn end with bulletrick.Code:select * from MyTable where MyColumn like '*bulletrick'
This query returns all rows where MyColumn contains bulletrick somewhere in the string.Code:select * from MyTable where MyColumn like '*bulletrick*'
Yep, I am using those statements but my program still produces errors.Quote:
Originally Posted by kaffenils
Can you post the error message and query.
You are using single not double quotes are you (as in the examples given).