FindRecord Method

Microsoft Access Visual Basic

FindRecord Method

       

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.

Match  Optional AcFindMatch.

AcFindMatch can be one of these AcFindMatch constants.
acAnywhere
acEntire default
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.

Search  Optional AcSearchDirection.

AcSearchDirection can be one of these AcSearchDirection constants.
acDown
acSearchAll default
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.

OnlyCurrentField  Optional AcFindField.

AcFindField can be one of these AcFindField constants.
acAll
acCurrent default

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

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