You can use the RecordsetType property to specify what kind of recordset is made available to a form. For example, 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 Snapshot.
Setting
The RecordsetType property uses the following settings in a Microsoft Access database (.mdb).
Setting | Visual Basic | Description |
---|---|---|
Dynaset | 0 | (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. For more information, see the topic that explains when you can update records from a query. |
Dynaset (Inconsistent Updates) | 1 | All tables and controls bound to their fields can be edited. |
Snapshot | 2 | No tables or the controls bound to their fields can be edited. |
The RecordsetType property uses the following settings in a Microsoft Access project (.adp).
Setting | Visual Basic | Description |
---|---|---|
Snapshot | 3 | No tables or the controls bound to their fields can be edited. |
Updatable Snapshot | 4 | (Default) All tables and controls bound to their fields can be edited. |
You can set this property by using a form's property sheet, a macro, or Visual Basic.
Note Changing the RecordsetType property of an open form or report causes an automatic recreation of the recordset.
Remarks
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.
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.