Solved

find like query with ado

Posted on 2001-07-17
8
289 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
 
LVL 4

Expert Comment

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

% should work fine with and ADO filter
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 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

16 Experts available now in Live!

Get 1:1 Help Now