Results 1 to 17 of 17

Thread: Help! - ADO navigation...

  1. #1

    Thread Starter
    Hyperactive Member Dodger's Avatar
    Join Date
    Mar 2001
    Posts
    433

    Exclamation Help! - ADO navigation...

    Hey All,

    I don't appear to have the seek function, maybe that's just for DAO, but what I need to do is:

    Search for a field which contains a specific value and position the cursor accordingly.

    My datasource is a data-aware class, which is populated from a delimited text-file. I uses the append methods to add fields to a recordset.

    Any idea on how I can accomplish this would be greatly appreciated.

    TIA.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    you can use

    objrs.find "fieldname = criteria"

    Is this what you wanted?

  3. #3

    Thread Starter
    Hyperactive Member Dodger's Avatar
    Join Date
    Mar 2001
    Posts
    433
    Oh, now I remember the problem, it's not possible to have a variable value for the criteria, right?

    What do I do?
    Last edited by Dodger; Apr 16th, 2002 at 01:14 PM.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    I don't wish to say "you're welcome"!!!

    OK NOW I DO!

    You're welcome



  5. #5
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    Originally posted by Dodger
    Oh, now I remember the problem, it's not possible to have a variable value for the criteria, right?

    What do I do?
    yep

    VB Code:
    1. rs.Find "Field1 = '" & strMyString  & "'"

  6. #6

    Thread Starter
    Hyperactive Member Dodger's Avatar
    Join Date
    Mar 2001
    Posts
    433

    Wink

    THANKS!

  7. #7

    Thread Starter
    Hyperactive Member Dodger's Avatar
    Join Date
    Mar 2001
    Posts
    433
    Oh, one more question.

    Is it possible to use the find function with multiple criteria?

  8. #8
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    indeed

    VB Code:
    1. rs.Find "Field1 = 'blah' AND Field2 = 'snuh'"

  9. #9
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    oops, just looked that up on MSDN (wasn't too sure about it), and apparetly you can't. i'm sure i've done it though...

  10. #10

    Thread Starter
    Hyperactive Member Dodger's Avatar
    Join Date
    Mar 2001
    Posts
    433
    Could you tell me how you did it?

  11. #11
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    well, i thought i did it like in the last example i posted, but then i looked at this on MSDN:

    Find Method
    The ActiveX Data Objects (ADO) version of the Find Method supports only singular column searches. As a result, using the "And" or "Or" keywords to append criteria will not work.

    Creating a new recordset will frequently provide better performance and does not limit you to single column filters.
    but that's confused me. first they say the Find method only supports singular column searches, then in the next sentence, they say it supports multiple searches!

    try using the code i just posted anyway

  12. #12

    Thread Starter
    Hyperactive Member Dodger's Avatar
    Join Date
    Mar 2001
    Posts
    433
    I tried this and it didn't work:

    dataContacts.Find "fName = '" & fldVal(0) & "' AND lName = '" & fldVal2(1) & "'"

  13. #13
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    the only thing i can suggest is to see what version of ADO you're using. other than that i'm not sure.

  14. #14

    Thread Starter
    Hyperactive Member Dodger's Avatar
    Join Date
    Mar 2001
    Posts
    433
    ADO 2.1

  15. #15
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    yeah, that's what i have referenced in my project... i'm sure it's possible somehow, but seeing as i don't have VB6 on this PC i can't try anything. sorry.

  16. #16

    Thread Starter
    Hyperactive Member Dodger's Avatar
    Join Date
    Mar 2001
    Posts
    433
    Thanks Anyway.

  17. #17
    Member
    Join Date
    Sep 2000
    Location
    Kentucky
    Posts
    56
    You can use .Filter with multiple criteria, but not .Find.

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