--- title: "Views Append 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: - "Append method [ADOX]" ms.assetid: b5b4c082-ac29-4f49-a8b8-e21b554c9b0d author: MightyPen ms.author: genemi --- # Views Append Method Example (VB) The following code demonstrates how to use a [Command](../../../ado/reference/ado-api/command-object-ado.md) object and the [Views](../../../ado/reference/adox-api/views-collection-adox.md) collection [Append](../../../ado/reference/adox-api/append-method-adox-views.md) method to create a new view in the underlying data source. ``` ' BeginCreateViewVB Sub Main() On Error GoTo CreateViewError Dim cmd As New ADODB.Command Dim cat As New ADOX.Catalog ' Open the Catalog cat.ActiveConnection = _ "Provider='Microsoft.Jet.OLEDB.4.0';" & _ "Data Source='Northwind.mdb';" ' Create the command representing the view. cmd.CommandText = "Select * From Customers" ' Create the new View cat.Views.Append "AllCustomers", cmd 'Clean up Set cat.ActiveConnection = Nothing Set cat = Nothing Set cmd = Nothing Exit Sub CreateViewError: Set cat = Nothing Set cmd = Nothing If Err <> 0 Then MsgBox Err.Source & "-->" & Err.Description, , "Error" End If End Sub ' EndCreateViewVB ``` ## See Also [ActiveConnection Property (ADOX)](../../../ado/reference/adox-api/activeconnection-property-adox.md) [Append Method (ADOX Views)](../../../ado/reference/adox-api/append-method-adox-views.md) [Catalog Object (ADOX)](../../../ado/reference/adox-api/catalog-object-adox.md) [View Object (ADOX)](../../../ado/reference/adox-api/view-object-adox.md) [Views Collection (ADOX)](../../../ado/reference/adox-api/views-collection-adox.md)