Solved

Using 'FindFirst' property of Data control

Posted on 2004-05-01
2
1,905 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

729 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