Updatable Property Example (MDB)

The following example adds a record to a Recordset object if the object's Updatable property setting is True (–1).

Sub UpdateData()
    Dim dbs As Database, rstUnknown As Recordset

    ' Return reference to current database.
    Set dbs = CurrentDb
    ' Open table-type Recordset object.
    Set rstUnknown = dbs.OpenRecordset("Unfamiliar Table")
    ' Check Updatable property before adding new record.
    If rstUnknown.Updatable = True Then
        With rstUnknown
            .AddNew
            !SomeField = "Some new data"
            .Update
        End With
    End If
    rstUnknown.Close
    Set dbs = Nothing
End Sub