A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"Like" operator in a query



 
 
Thread Tools Display Modes
  #1  
Old December 28th, 2004, 03:13 PM
genojoe
external usenet poster
 
Posts: n/a
Default "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  
Old December 28th, 2004, 03:35 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 05:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.