Solved

find like query with ado

Posted on 2001-07-17
8
305 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 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

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!

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

726 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