DoCmd.GoToRecord (Access)
The GoToRecord method carries out the GoToRecord action in Visual Basic.
You can use the GoToRecord method to make the specified record the current record in an open table, form, or query result set. If you leave the ObjectType and ObjectName arguments blank (the default constant, acActiveDataObject, is assumed for ObjectType), the active object is assumed. You can use the GoToRecord method to make a record on a hidden form the current record if you specify the hidden form in the ObjectType and ObjectName arguments.
GoToRecord (ObjectType, ObjectName, Record, Offset)
DoCmd.GoToRecord acDataForm, "Employees", acGoTo, 7
Arguments
Optional arguments
The following arguments are optional
ObjectType (AcDataObjectType) - An AcDataObjectType constant that specifies the type of object that contains the record that you want to make current.
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) - A string expression that's the valid name of an object of the type selected by the ObjectType argument.
Record (AcRecord) - An AcRecord constant that specifies the record to make the current record. The default value is acNext.
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. |
Offset (Long) - A numeric expression that represents the number of records to move forward or backward if you specify acNext or acPrevious for the Record argument, or the record to move to if you specify acGoTo for the Record argument. The expression must result in a valid record number.