DataUpdatable Property Example (MDB)

The following example creates two Recordset objects, a dynaset-type Recordset object and a snapshot-type Recordset object, from the same table. The procedure then checks the DataUpdatable property for the LastName field in each Recordset object. The setting of the DataUpdatable property is True (–1) for the dynaset-type Recordset object, and False (0) for the snapshot-type Recordset object.

Sub CheckUpdatable()
    Dim dbs As Database
    Dim rstDynaset As Recordset, rstSnapshot As Recordset
    Dim fldDynaset As Field, fldSnapshot As Field

    ' Return reference to current database.
    Set dbs = CurrentDb
    ' Open dynaset-type Recordset object.
    Set rstDynaset = dbs.OpenRecordset("Employees", _
        dbOpenDynaset)
    ' Open snapshot-type Recordset object.
    Set rstSnapshot = dbs.OpenRecordset("Employees", _
        dbOpenSnapshot)
    ' Get Field object variables pointing to field in 
    ' each Recordset object.
    Set fldDynaset = rstDynaset.Fields!LastName
    Set fldSnapshot = rstSnapshot.Fields!LastName
    ' Get current record.
    rstDynaset.MoveFirst
    rstSnapshot.MoveFirst
    ' Display value of DataUpdatable property for each 
    ' Recordset object.
    Debug.Print "DataUpdatable (Dynaset-type Recordset): "; _
        fldDynaset.DataUpdatable
    Debug.Print "DataUpdatable (Snapshot-type Recordset): "; _
        fldSnapshot.DataUpdatable
    rstDynaset.Close
    rstSnapshot.Close
    Set dbs = Nothing
End Sub