Updatable Property Example

This example demonstrates the Updatable property for a Database, four types of Recordset objects, a TableDef, and a QueryDef.

Sub UpdatableX()

    Dim dbsNorthwind As Database
    Dim rstEmployees As Recordset

    Set dbsNorthwind = OpenDatabase("Northwind.mdb")

    With dbsNorthwind
        Debug.Print .Name
        Debug.Print "  Updatable = " & .Updatable

        ' Default is dbOpenTable.
        Set rstEmployees = .OpenRecordset("Employees")
        Debug.Print _
            "Table-type recordset from Employees table"
        Debug.Print "  Updatable = " & _
            rstEmployees.Updatable
        rstEmployees.Close

        Set rstEmployees = .OpenRecordset("Employees", _
            dbOpenDynaset)
        Debug.Print _
            "Dynaset-type recordset from Employees table"
        Debug.Print "  Updatable = " & _
            rstEmployees.Updatable
        rstEmployees.Close

        Set rstEmployees = .OpenRecordset("Employees", _
            dbOpenSnapshot)
        Debug.Print _
            "Snapshot-type recordset from Employees table"
        Debug.Print "  Updatable = " & _
            rstEmployees.Updatable
        rstEmployees.Close

        Set rstEmployees = .OpenRecordset("Employees", _
            dbOpenForwardOnly)
        Debug.Print _
            "Forward-only-type recordset from Employees table"
        Debug.Print "  Updatable = " & _
            rstEmployees.Updatable
        rstEmployees.Close

        Debug.Print "'" & .TableDefs(0).Name & "' TableDef"
        Debug.Print "  Updatable = " & _
            .TableDefs(0).Updatable

        Debug.Print "'" & .QueryDefs(0).Name & "' QueryDef"
        Debug.Print "  Updatable = " & _
            .QueryDefs(0).Updatable

        .Close
    End With

End Sub