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

DoCmd.GoToRecord Method (Access)

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

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


expression. GoToRecord( ** ObjectType, ** ObjectName, ** Record, ** Offset )

expression A variable that represents a DoCmd object.


NameRequired/OptionalData TypeDescription
ObjectTypeOptionalAcDataObjectTypeA AcDataObjectType constant that specifies the type of object that contains the record you want to make current.
ObjectNameOptionalVariantA string expression that's the valid name of an object of the type selected by the objecttype argument.
RecordOptionalAcRecordA AcRecord constant that specifies the record to make the current record. The default value is acNext.
OffsetOptionalVariantA 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.


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.


The following example uses the GoToRecord method to make the seventh record in the form Employees current:

DoCmd.GoToRecord acDataForm, "Employees", acGoTo, 7

See also


DoCmd Object

© 2018 Microsoft