Solved

Using 'FindFirst' property of Data control

Posted on 2004-05-01
2
1,903 Views
Last Modified: 2013-11-25
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
Comment
Question by:mi5
2 Comments
 
LVL 11

Assisted Solution

by:bingie
bingie earned 25 total points
ID: 10968481
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
 
LVL 1

Accepted Solution

by:
puneesh earned 25 total points
ID: 10976348
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question