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.
Re: alternative of “Findfirst” in ADO
The exact equivalent of that is rather simple to find, it's like this:
VB Code:
rstUser.MoveFirst
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:
Dim strSQL as String
strSQL = "SELECT [i]fields[/i] FROM [i]tablename[/i] WHERE UsedID=" & cmbBankBr.Text
'use strSQL to open the recordset
Re: alternative of “Findfirst” in ADO
Please look at the help of "filter" property of ADO , u will easily get ur answer.
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:
rstUser.MoveFirst
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:
Dim strSQL as String
strSQL = "SELECT [i]fields[/i] FROM [i]tablename[/i] WHERE UsedID=" & cmbBankBr.Text
'use strSQL to open the recordset
i want to select that record, then view it and update it. ok I'll try.