Dynaset-Type Recordset Example

This example opens a dynaset-type Recordset and shows the extent to which its fields are updatable.

Sub dbOpenDynasetX()

    Dim dbsNorthwind As Database
    Dim rstInvoices As Recordset
    Dim fldLoop As Field

    Set dbsNorthwind = OpenDatabase("Northwind.mdb")
    Set rstInvoices = _
        dbsNorthwind.OpenRecordset("Invoices", dbOpenDynaset)

    With rstInvoices
        Debug.Print "Dynaset-type recordset: " & .Name

        If .Updatable Then
            Debug.Print "  Updatable fields:"

            ' Enumerate Fields collection of dynaset-type
            ' Recordset object, print only updatable
            ' fields.
            For Each fldLoop In .Fields
                If fldLoop.DataUpdatable Then
                    Debug.Print "    " & fldLoop.Name
                End If
            Next fldLoop

        End If

        .Close
    End With

    dbsNorthwind.Close

End Sub