?
Solved

find like query with ado

Posted on 2001-07-17
8
Medium Priority
?
313 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 200 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

765 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