• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1925
  • Last Modified:

Using 'FindFirst' property of Data control

I have 5 text boxes linked to fields in an Access database, the table being controlled by a Data control. I'm adding a search facility, and I'm not quite sure how to work the 'FindFirst' property. Syntax should be data.recordset.findfirst(criteria) - but I don't know how to format the criteria. How is it done? Thanks.
0
mi5
Asked:
mi5
2 Solutions
 
bingieCommented:
The syntax is:

Data1.Recordset.FindFirst (field_name = "search_string")

Where filed_name is the name of the field you want to search and
search_string is the sting you want to search for.

It will find the first instance of the string.
0
 
puneeshCommented:
Consider a table named "Names" containing 2 fields, FirstName and SecondName. Now you want to search based upon FirstName. The code would be:

Dim strSearch as String

strSearch = "Your search Value here"
Data1.Recordset.FindFirst ("FirstName = '" & strSearch & "'")


The "Criteria" argument of FindFirst method is of "String" type. Therefore it need to be enclosed into double Quotes.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now