Results 1 to 6 of 6

Thread: ADO Find

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    21

    Unhappy

    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?

  2. #2
    Guest
    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

  3. #3
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    personally i would not use ADO.find
    i would find sql to find specific records..


  4. #4
    Guest
    The line above isnt very readable so here it is again

    .Find "CustomerName = " & " ' " & CustName & " ' "




  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    21
    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.

  6. #6
    New Member
    Join Date
    May 2001
    Location
    Wales
    Posts
    1

    SQL?

    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width