Skip to content

Latest commit

 

History

History
52 lines (44 loc) · 1.34 KB

File metadata and controls

52 lines (44 loc) · 1.34 KB
title Views Delete Method Example (VB) | Microsoft Docs
ms.prod sql
ms.prod_service connectivity
ms.technology connectivity
ms.custom
ms.date 01/19/2017
ms.reviewer
ms.topic conceptual
dev_langs
VB
helpviewer_keywords
Delete method [ADOX]
ms.assetid 17df2a83-4166-4df8-8c17-0a33aaac8582
author MightyPen
ms.author genemi

Views Delete Method Example (VB)

The following code shows how to use the Delete method to delete a view from the catalog.

' BeginDeleteViewVB  
Sub Main()  
    On Error GoTo DeleteViewError  
  
    Dim cat As New ADOX.Catalog  
  
    ' Open the catalog  
    cat.ActiveConnection = "Provider='Microsoft.Jet.OLEDB.4.0';" & _  
        "Data Source='Northwind.mdb';"  
  
    'Delete the View  
    cat.Views.Delete "AllCustomers"  
  
    'Clean up  
    Set cat.ActiveConnection = Nothing  
    Set cat = Nothing  
    Exit Sub  
  
DeleteViewError:  
    Set cat = Nothing  
  
    If Err <> 0 Then  
        MsgBox Err.Source & "-->" & Err.Description, , "Error"  
    End If  
End Sub  
' EndDeleteViewVB  

See Also

Delete Method (ADOX Collections)
Views Collection (ADOX)