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 | An AcDataObjectType constant that specifies the type of object that contains the record that 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 | An 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
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.
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 Employees form current.
DoCmd.GoToRecord acDataForm, "Employees", acGoTo, 7
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기