Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO recordset.Find using 2 fields?

Status
Not open for further replies.

rwilliams

Programmer
Aug 9, 2001
17
GB
I want to search through a recordset to find a record where customer = ... and custaddress = ....

if i use rsCustomers.Find("customer = '....'")
it works. How do I add the second condition?

I've tried rsCustomers.Find"=("customer = ' ....' and custaddress = '....') and a few variations but got nowhere.

Please help.
 
Hi,

.Find does not support searches in mutiple fields.
Use can use .Multifind, or do the search by opening a new recordset.
Look out for quotes and double quotes if you search in string fields using .find or .multifind!
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
it's an ado recordset and doesn't have a multifind method. it hadn't actually occurred to me that find might not support multiple fields though so i'll probably do what you suggest and open a new recordset.

thanks.
 
If it's a disconnected recordset, then you can .filter it on multiple fields:

rsCustomers.Filter = "customer = ' ....' and custaddress = '....'"

That will leave you with a recordset with just the records that match those conditions. You can then remove the filter to see all the other records again:

rsCustomers.Filter = "" -Chris Didion
Matrix Automation, MCP
 
thanks a lot chris and sunaj, much appreciated.
 
Oh well. Another "MichaelRed" come lately to the fray.

In the general sense, use of Find in any ver is probably a bad idea gone awry. If you KNOW what to "find", you can 'collect' the whole set in a simple query to begin with.

So, WHY would you do a "find" in any case? I'm reasonable sure that the "find" nethod(s) are just wrappers for a SQL command, so your'e just being lazy (and therefore slow and slothful) in making the little old lady do the typing of the "Select ... from ... " words.

(P.S. don't think I haven't used the silly thing, it is just that it IS silly!)

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top