Solved

Using 'FindFirst' property of Data control

Posted on 2004-05-01
2
1,904 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 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