Solved

find like query with ado

Posted on 2001-07-17
8
284 Views
Last Modified: 2012-06-27
my left side match works fine, searching on "M" for example might return maine, massachusets..

I also need searches to match the right of the string and a contains.  I thought this would work.  The database field is a string.  I get the error "Arguments are of the wrong type..

any ideas,
thanks



Select Case SearchHow
                    Case "Left"
                         TempRs.Find "CatalogNo like '" & SearhString & "*'", SearchDirection:=adSearchForward, start:=adBookmarkFirst
                    Case "Right"
                            TempRs.Find "CatalogNo like '*" & SearhString & "'", SearchDirection:=adSearchForward, start:=adBookmarkFirst
                    Case "Contains"
                        TempRs.Find "CatalogNo like '*" & SearhString & "*'", SearchDirection:=adSearchForward, start:=adBookmarkFirst
                End Select
0
Comment
Question by:DHOPKINS
8 Comments
 
LVL 20

Expert Comment

by:hes
Comment Utility
Insteead of the * try using  %
0
 

Author Comment

by:DHOPKINS
Comment Utility
The % gives me the same error
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 50 total points
Comment Utility
This is not supported.

Here is an article in MSDN that documents it:
Q226119
INFO: ADO's Find and Filter Support Usage of Wildcards

One workaround would be to create a recordset with this condition.

Anthony
0
 
LVL 4

Expert Comment

by:nutwiss
Comment Utility
using .filter = "myfield like %mystuff"

% should work fine with and ADO filter
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 4

Expert Comment

by:nutwiss
Comment Utility
you could always store the bookmark before you perform the filter - then set it afterwards

if the bookmarked record is not in the filtered recordset then setting the bookmark will move to the NEXT available record - which I belive is exactly what you wish to do?
0
 
LVL 4

Expert Comment

by:nutwiss
Comment Utility
personally I never use .find but .filter comes in handy all the time :)
0
 
LVL 4

Expert Comment

by:nutwiss
Comment Utility
sorry, I've just read the KB article - what a disgrace - BTW I've just been informed that it's not even supported yet in MDAC 2.6

sorry.

so, yes, as acperkins says - you'll probably have to requery with an addition to the where clause. shame :(
0
 

Author Comment

by:DHOPKINS
Comment Utility
Thanks, I can use a filter (Actually makes more sense with a contains query, then just moving the cursor), Since I can't split the points and all the information was very good I had to basically flip a coin.  Anyways, gratitude to all.

Thanks,
David
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now