Solved

find like query with ado

Posted on 2001-07-17
8
298 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
ID: 6291223
Insteead of the * try using  %
0
 

Author Comment

by:DHOPKINS
ID: 6291264
The % gives me the same error
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 50 total points
ID: 6291422
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 4

Expert Comment

by:nutwiss
ID: 6291443
using .filter = "myfield like %mystuff"

% should work fine with and ADO filter
0
 
LVL 4

Expert Comment

by:nutwiss
ID: 6291448
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
ID: 6291451
personally I never use .find but .filter comes in handy all the time :)
0
 
LVL 4

Expert Comment

by:nutwiss
ID: 6291461
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
ID: 6291546
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

856 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