Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Latest commit

 

History

History
63 lines (35 loc) · 2.14 KB

docmd-gotorecord-method-access.md

File metadata and controls

63 lines (35 loc) · 2.14 KB
title keywords f1_keywords ms.prod api_name ms.assetid ms.date
DoCmd.GoToRecord Method (Access)
vbaac10.chm4154
vbaac10.chm4154
access
Access.DoCmd.GoToRecord
5494b6fc-112f-e944-9072-873b00271ab1
06/08/2017

DoCmd.GoToRecord Method (Access)

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

Syntax

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

expression A variable that represents a DoCmd object.

Parameters

Name Required/Optional Data Type Description
ObjectType Optional AcDataObjectType A AcDataObjectType constant that specifies the type of object that contains the record you want to make current.
ObjectName Optional Variant A string expression that's the valid name of an object of the type selected by the objecttype argument.
Record Optional AcRecord A AcRecord constant that specifies the record to make the current record. The default value is acNext.
Offset Optional Variant 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.

Remarks

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.

Example

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

Concepts

DoCmd Object