Share via


FindRecord Method [Access 2003 VBA Language Reference]

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

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

expression Required. An expression that returns one of the objects in the Applies To list.

FindWhat  Required Variant. An expression that evaluates to text, a number, or a date. The expression contains the data to search for.

AcFindMatch

AcFindMatch can be one of these AcFindMatch constants.
acAnywhere
acEntiredefault
acStart

If you leave this argument blank, the default constant (acEntire) is assumed.

MatchCase  Optional Variant. Use 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.

AcSearchDirection

AcSearchDirection can be one of these AcSearchDirection constants.
acDown
acSearchAlldefault
acUp

If you leave this argument blank, the default constant (acSearchAll) is assumed.

SearchAsFormatted  Optional Variant. Use 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.

AcFindField

AcFindField can be one of these AcFindField constants.
acAll
acCurrentdefault

If you leave this argument blank, the default constant (acCurrent) is assumed.

FindFirst  Optional Variant. Use 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

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.

For more information on how the action and its arguments work, see the action topic.

You can leave an optional argument blank in the middle of the syntax, but you must include the argument's comma. If you leave one or more trailing arguments blank, don't use a comma following the last argument you specify.

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

Applies to | DoCmd Object