Views Refresh Method Example (VB)

Microsoft ActiveX Data Objects (ADO)

ADOX 2.5

Views Refresh Method Example (VB)

The following code shows how to refresh the Views collection of a Catalog. This is required before View objects from the Catalog can be accessed.

' BeginViewsRefreshVB
Sub Main()
    On Error GoTo ProcedureViewsRefreshError

    Dim cat As New ADOX.Catalog
    
    ' Open the Catalog
    cat.ActiveConnection = "Provider='Microsoft.Jet.OLEDB.4.0';" & _
        "Data Source='c:\Program Files\" & _
        "Microsoft Office\Office\Samples\Northwind.mdb';"
    
    ' Refresh the Procedures collection
    cat.Views.Refresh
    
    'Clean up
    Set cat = Nothing
    Exit Sub
    
ProcedureViewsRefreshError:

    If Not cat Is Nothing Then
        Set cat = Nothing
    End If
    
    If Err <> 0 Then
        MsgBox Err.Source & "-->" & Err.Description, , "Error"
    End If
End Sub
' EndViewsRefreshVB

See Also

Refresh Method | Views Collection

© 1998-2003 Microsoft Corporation. All rights reserved.