Goran Level: Moderator
 Registered: 16-05-2002 Posts: 1681
|
Re: search access database
It all depends if you are using ADO or DAO, if you are using Data control/ADODC control or creating recordsets through code.
' Data control - find record based on string search
Data1.Recordset.FindFirst "Name='" & Text1.Text & "'"
' DAO recordset - find record based on numeric search
rs.FindFirst "Age=" & text1.text
' ADODC control - find record (string search) that is begining with text1.text value
Adodc1.Recordset.Find "Name Like '" & Text1.Text & "*'"
' ADO recordset - find record (string search) that has text1.text value anywhere in it.
rs.Find "Name Like '*" & text1.text & "*'" |
Note that when searching strings you need to put value to be searched for between single quotes ("Name='Ryan'") and when searching for numeric values, no single quotes are used ("Age=22")
One thing to add, unlike DAO FindFirst method, ADO Find method has 4 parameters: criteria, SkipRows, searchDirection and start... Check documentation on how they are used.
[Edited by Goran on 21-11-2004 at 02:50 AM GMT]
____________________________
If you find the answer helpful, please mark this topic as solved.
|