Click to See Complete Forum and Search --> : ADO Find
adam01
Aug 25th, 2000, 07:12 AM
I have a problem using the ADO find method in my VB6 application. I have an ADO Recordset which grabs all records of a table (CUSTOMERS). I used a find method such as ado.recordset.find ("CustomerID = " & CustID & "") and it worked great. However, I overwrote that line with a new find statement that I needed: ado.recordset.find ("CustomerName = " & CustName & "") This time when I run it, I get an error " application using arguments out of range or in conflict with one another". Both the CustName and the CustID variables are inputted by the user using an inputbox method at run time. Basically, it seems to work for numeric and not strings. Any help?
Hi Adam
You could try:-
.Find "CustomerName = " & "'" & CustName & "'"
I seem to remember having a similar problem
some time ago and I think using single quotes
solved it.
Beware though my memory is that if CustName contains
a single quote you will get an error
Regards
SeanR
kovan
Aug 25th, 2000, 07:38 AM
personally i would not use ADO.find
i would find sql to find specific records..
The line above isnt very readable so here it is again
.Find "CustomerName = " & " ' " & CustName & " ' "
adam01
Aug 25th, 2000, 07:46 AM
Many thanks SeanR. The single quotes worked great. It's a little unusual that Microsoft doesn't list anything on this little scenario. Thanks again to all who responded.
Fairlane
May 18th, 2001, 08:45 AM
I could understand if you wanted to retrieve all records for a particular customer, you would use SQL. But if you are retrieving only one record why wouldn't you use .Find?
Narrowing the recordset with an SQL means that you would then have to requery the recordset to get all the records back. This may not matter on a small database, but what about system and performance on a large database?
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.