If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
"Like" operator in a query
In "SQL Server Compatible Syntax" setting in Options dialog; Table/Queries
tab, I do not check "This database". In this database the following query returns two records: SELECT Filters.Filter FROM Filters WHERE (((Filters.Filter) Like "*Classes*")); If I write code as follows, it returns no records: Dim adoRS As New ADODB.Recordset sSQL = "SELECT Filters.Filter FROM Filters WHERE (((Filters.Filter) Like ""*Classes*""));" adoRS.Open sSQL, oConn If adoRS.EOF Then Debug.Print "No Records" End If Is there a way to get ADODB code to properly handle the "Like" operator? |
#2
|
|||
|
|||
Use "%" rather than "*" in ADO.
-- Duane Hookom MS Access MVP -- "genojoe" wrote in message news In "SQL Server Compatible Syntax" setting in Options dialog; Table/Queries tab, I do not check "This database". In this database the following query returns two records: SELECT Filters.Filter FROM Filters WHERE (((Filters.Filter) Like "*Classes*")); If I write code as follows, it returns no records: Dim adoRS As New ADODB.Recordset sSQL = "SELECT Filters.Filter FROM Filters WHERE (((Filters.Filter) Like ""*Classes*""));" adoRS.Open sSQL, oConn If adoRS.EOF Then Debug.Print "No Records" End If Is there a way to get ADODB code to properly handle the "Like" operator? |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AVG Function in a Query | JohnL | Running & Setting Up Queries | 5 | December 18th, 2004 05:52 AM |
Here's a shocker | Mike Labosh | General Discussion | 2 | October 26th, 2004 05:04 PM |
Return repeats info in "8s" | Joy Rose | Running & Setting Up Queries | 14 | October 13th, 2004 10:07 PM |
Big number gives error! | Sara Mellen | Running & Setting Up Queries | 8 | October 11th, 2004 02:48 AM |
Display Parameter from Form on Report | sara | Setting Up & Running Reports | 10 | July 19th, 2004 04:54 PM |