Table of contents
TOC
Collapse the table of content
Expand the table of content

DoCmd.FindRecord Method (Access)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

The FindRecord method carries out the FindRecord action in Visual Basic.

Syntax

expression. FindRecord( ** FindWhat, ** Match, ** MatchCase, ** Search, ** SearchAsFormatted, ** OnlyCurrentField, ** FindFirst** )

expression A variable that represents a DoCmd object.

Parameters

NameRequired/OptionalData TypeDescription
FindWhatRequiredVariantAn expression that evaluates to text, a number, or a date. The expression contains the data to search for.
MatchOptionalAcFindMatchAn AcFindMatch constant that specifies where to search for the match. The default value is acEntire.
MatchCaseOptionalVariantUse True for a case-sensitive search and False for a search that's not case-sensitive. If you leave this argument blank, the default ( False ) is assumed.
SearchOptionalAcSearchDirectionAn AcSearchDirection constant that specifies the direction to search. The default value is acSearchAll.
SearchAsFormattedOptionalVariantUse True to search for data as it's formatted and False to search for data as it's stored in the database. If you leave this argument blank, the default ( False ) is assumed.
OnlyCurrentFieldOptionalAcFindFieldAn AcFindField constant that specifies whether to search all fields, or only the current field. The default value is acCurrent.
FindFirstOptionalVariantUse True to start the search at the first record. Use False to start the search at the record following the current record. If you leave this argument blank, the default ( True ) is assumed.

Remarks

When a procedure calls the FindRecord method, Access searches for the specified data in the records (the order of the search is determined by the setting of the Search argument). When Access finds the specified data, the data is selected in the record.

The FindRecord method does not return a value indicating its success or failure. To determine whether a value exists in a recordset, use the FindFirst, FindNext, FindPrevious or FindLast method of the Recordset object. These methods set the value of the NoMatch property to True if the spcified value is not found.

Example

The following example finds the first occurrence in the records of the name Smith in the current field. It doesn't find occurrences of smith or Smithson.

DoCmd.FindRecord "Smith",, True,, True

See also

Concepts

DoCmd Object

© 2017 Microsoft