Link to home
Start Free TrialLog in
Avatar of YouSee
YouSeeFlag for India

asked on

Multi Value Find ADO

How to find record satisfing 2 or more conditions using ADODB.Recordset's Find method?

Thanks in advance.
Avatar of Dr. Kamal Mehdi
Dr. Kamal Mehdi
Flag of Greece image

Example:

MyCriteria = "FirstName = 'Ali' AND LastName='Baba'"
MyRS.FindFirst MyCriteria

Regards.
ASKER CERTIFIED SOLUTION
Avatar of Bahnass
Bahnass
Flag of Egypt image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of K7
K7

Hi

kamall: acording to the spwcs in MSDN "Only a single-column name may be specified in criteria. This method does not support multi-column searches."

Filter will work but i personaly like using SQL to achive basically the same as with the filter property. u simply open a new recodset using an SQL statement which includes the conditions in the where clause.
i prefere this method bc the searching/filtering is done by the DBsystem also if the DB  is on another computer it reduces the amoutn of data that needs to be transmitted.

i hpe this helps

Cat
When I have this need, I concatenate the fields in the query into a new field and use the Find method against this new field:

Select LastName + FirstName AS NewField, LastName, FirstName FROM Table ....


And then you can do this:

MyRS.Find "NewField = 'AliBaba'"
I would not be surprised to find that if you are using server side cursors it could be faster to request a new recordset (which allows a where statement with multiple criteria).   It should be faster because the required fields in your where could be indexed fields.  If you use find it will search the current cursor (which may not be indexed) and may even take longer.   But if your recordset was created from a selected extract from a very large non-indexed table it would be faster to use the Find method (but you can't because you need more than one criteria).

Maybe others have different views and enhanced knowledge.
What
YouSee
inthedark
;-)
Avatar of YouSee

ASKER

It could not answer my question. And all the answers posted are from basic description from Microsoft.
Hi YouSee,
You've requested to delete this question, but its status remains as 'Pending Delete' because one or more comments have been added.  Normally, the only way to fully delete such a Question is to post a message to Community Support and ask for assistance.

EE is making a one-time database sweep to purge the Pending Delete Questions automatically.  During this sweep:

    YouSee -- To allow the deletion to proceed:  Do nothing.
    EXPERTS -- Please DON'T POST a comment except to contest this deletion.

In the future, please refer to https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp#8 for instruction on deleting questions.

DanRollins -- EE database cleanup volunteer
Bahnass and I have posted correct workarounds.
ASKER GOT Clear Answer from Microsoft that

FIND    Can not accept more than one condition

Work arround is using filter

this information is useful for asker & others ( lookinkg in PAQ)

If Not Points to Bahnass then Points To emoreau !!!

By the way did any expert made a utility to know Askers
Profile quickly online!!!
:-)
Recommended disposition:

    Split points between: Bahnass and emoreau

DanRollins -- EE database cleanup volunteer
Per recommendation, force-accepted.

Netminder
CS Moderator

emoreau: points for you at https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20315276