DoCmd.SearchForRecord (Access)
You can use the SearchForRecord method to search for a specific record in a table, query, form, or report.
In cases where more than one record matches the criteria in the WhereCondition argument, the following factors determine which record is found:
SearchForRecord (ObjectType, ObjectName, Record, WhereCondition)
DoCmd.SearchForRecord
Arguments
Optional arguments
The following arguments are optional
ObjectType (AcDataObjectType) - An AcDataObjectType constant that specifies the type of database object in which you are searching. The default value is acActiveDataObject.
Possible values are
acActiveDataObject | The active object contains the record. |
acDataForm | A form contains the record. |
acDataFunction | A user-defined function contains the record (Microsoft Access project only). |
acDataQuery | A query contains the record. |
acDataReport | A report contains the record. |
acDataServerView | A server view contains the record (Microsoft Access project only). |
acDataStoredProcedure | A stored procedure contains the record (Microsoft Access project only). |
acDataTable | A table contains the record. |
ObjectName (String) - The name of the database object that contains the record to search for.
Record (AcRecord) - An AcRecord constant that specifies the starting point and direction of the search. The default value is acFirst.
Possible values are
acFirst | Make the first record the current record. |
acGoTo | Make the specified record the current record. |
acLast | Make the last record the current record. |
acNewRec | Make a new record the current record. |
acNext | Make the next record the current record. |
acPrevious | Make the previous record the current record. |
WhereCondition (String) - A string used to locate the record. It is like the WHERE clause in an SQL statement, but without the word WHERE.