Table of contents
TOC
折叠目录
展开目录

DoCmd.GoToRecord 方法 (访问)DoCmd.GoToRecord Method (Access)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

方法执行 Visual Basic 中的 GoToRecord 操作。The GoToRecord method carries out the GoToRecord action in Visual Basic.

语法Syntax

表达式(* 对象类型对象名称记录偏移量)expression. **GoToRecord( ** ObjectType, ** ObjectName, ** Record, ** Offset* )

表达式_一个表示DoCmd对象的变量。_expression A variable that represents a DoCmd object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
对象类型ObjectType可选OptionalAcDataObjectTypeAcDataObjectType一个AcDataObjectType常量,指定包含要作为当前的记录的对象的类型。A AcDataObjectType constant that specifies the type of object that contains the record you want to make current.
对象名称ObjectName可选OptionalVariantVariant字符串表达式,由_对象类型_参数所选类型对象的有效名称。A string expression that's the valid name of an object of the type selected by the objecttype argument.
RecordRecord可选OptionalAcRecordAcRecord一个AcRecord常量,指定要作为当前记录的记录。默认值是acNextA AcRecord constant that specifies the record to make the current record. The default value is acNext.
OffsetOffset可选OptionalVariantVariant数值表达式,表示的记录将向前或向后移动如果指定acNextacPrevious对_记录_参数或要将移到,如果指定acGoTo的_记录_的记录数参数。表达式的结果必须在有效的记录数。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.

如果将_对象类型_和_对象名称_参数保留为空 (默认常量, acActiveDataObject,则假定为_对象类型_),则假定活动对象。If you leave the objecttype and objectname arguments blank (the default constant, acActiveDataObject, is assumed for objecttype), the active object is assumed.

您可以使用GoToRecord方法使隐藏窗体上的记录成为当前记录,如果在_对象类型_和_对象名称_参数中指定了隐藏窗体。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

下面的示例使用GoToRecord方法来使雇员窗体中的第七个记录当前: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 对象DoCmd Object

© 2018 Microsoft