Results 1 to 4 of 4

Thread: alternative of “Findfirst” in ADO

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    185

    alternative of “Findfirst” in ADO

    I use VB5/vb6, Access Database, ADO.
    I want an alternative way for ADO as “Findfirst” of DAO.
    (Actually I need to know this data is in the database or not)

    For Example
    -------------------
    DAO Code was:
    Code:
    dim rstUser as recordset
    rstUser.FindFirst ("UsedID=" & cmbBankBr.Text )
    --------------------
    but this code cannot work with ADO.

    any one please help me.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: alternative of “Findfirst” in ADO

    The exact equivalent of that is rather simple to find, it's like this:
    VB Code:
    1. rstUser.MoveFirst
    2. rstUser.Find "UsedID=" & cmbBankBr.Text

    What would probably be better tho (if appropriate) is to only load the relevant data into the recordset in the first place, using an SQL statement like this:
    VB Code:
    1. Dim strSQL as String
    2.   strSQL = "SELECT [i]fields[/i] FROM [i]tablename[/i] WHERE UsedID=" & cmbBankBr.Text
    3.   'use strSQL to open the recordset

  3. #3
    Addicted Member mabbas110's Avatar
    Join Date
    Oct 2005
    Location
    Karachi , Pakistan
    Posts
    172

    Re: alternative of “Findfirst” in ADO

    Please look at the help of "filter" property of ADO , u will easily get ur answer.
    Thanks and Regards,

    Muhammad Abbas

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    185

    Re: alternative of “Findfirst” in ADO

    thanx to you all

    Quote Originally Posted by si_the_geek
    The exact equivalent of that is rather simple to find, it's like this:
    VB Code:
    1. rstUser.MoveFirst
    2. rstUser.Find "UsedID=" & cmbBankBr.Text

    What would probably be better tho (if appropriate) is to only load the relevant data into the recordset in the first place, using an SQL statement like this:
    VB Code:
    1. Dim strSQL as String
    2.   strSQL = "SELECT [i]fields[/i] FROM [i]tablename[/i] WHERE UsedID=" & cmbBankBr.Text
    3.   'use strSQL to open the recordset

    i want to select that record, then view it and update it. ok I'll try.

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