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

Form.RecordsetType 属性 (访问)Form.RecordsetType Property (Access)

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

记录集类型属性用于指定哪种类型的记录集可用于窗体。读取/写入字节You can use the RecordsetType property to specify what kind of recordset is made available to a form. Read/write Byte.

语法Syntax

表达式记录集类型expression. RecordsetType

表达式_表示一个窗体对象的变量。_expression A variable that represents an Form object.

注解Remarks

记录集类型属性在 Microsoft Access 数据库中使用下列设置。The RecordsetType property uses the following settings in a Microsoft Access database.

设置Setting类型的记录集Type of Recordset说明Description
00动态集Dynaset(默认值)您可以编辑绑定的控件基于单个表或一对一关系的表。对于基于具有一对多的关系表的字段的绑定控件,则无法编辑关系的"一"方的联接字段中的数据,除非允许表间的级联更新(Default) You can edit bound controls based on a single table or tables with a one-to-one relationship. For controls bound to fields based on tables with a one-to-many relationship, you can't edit data from the join field on the "one" side of the relationship unless cascade update is enabled between the tables
11动态集(不一致的更新)Dynaset (Inconsistent Updates)所有绑定到其字段的表和控件都可以编辑。All tables and controls bound to their fields can be edited.
22快照Snapshot绑定到其字段的表和控件都不能编辑。No tables or the controls bound to their fields can be edited.

请注意 如果您不希望在窗体视图或数据表视图中窗体时编辑绑定控件中的数据,您可以将RecordsetType属性设置为 2。Note If you don't want data in bound controls to be edited when a form is in Form view or Datasheet view, you can set the RecordsetType property to 2.

请注意 已打开的窗体或报表的记录集类型属性更改将导致自动重新创建记录集。Note Changing the RecordsetType property of an open form or report causes an automatic recreation of the recordset.

您还可以基于其字段绑定到窗体上控件的多个基础表的窗体。根据记录集类型属性设置,可以限制哪些绑定控件可以编辑。You can create forms based on multiple underlying tables with fields bound to controls on the forms. Depending on the RecordsetType property setting, you can limit which of these bound controls can be edited.

除了由记录集类型提供的编辑控件,在窗体上的每个控件还具有Locked属性可以设置以指定是否可以编辑控件及其基础数据。如果将锁定属性设置为是,则不能编辑数据。In addition to the editing control provided by RecordsetType, each control on a form has a Locked property that you can set to specify whether the control and its underlying data can be edited. If the Locked property is set to Yes, you can't edit the data.

示例Example

在以下示例中,只有当用户 ID 为 ADMIN 时,才可以记录更新。此代码示例将记录集类型属性设置为快照如果公用变量 gstrUserID 值不是管理员。In the following example, only if the user ID is ADMIN can records be updated. This code sample sets the RecordsetType property to Snapshot if the public variable gstrUserID value is not ADMIN.

Sub Form_Open(Cancel As Integer) 
 Const conSnapshot = 2 
 If gstrUserID <> "ADMIN" Then 
 Forms!Employees.RecordsetType = conSnapshot 
 End If 
End Sub

属性值Property value

UINT8UINT8

© 2018 Microsoft