Create view : View « Access « VBA / Excel / Access / Word






Create view

 

Sub CreateQuery()
    
    Dim cat As New ADOX.Catalog
    Dim cd As New ADODB.Command
    Dim sSQL As String
    
    cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
       "Data Source=C:\mydb.mdb;"
    
    sSQL = "SELECT * FROM Newtable"
    
    cd.CommandText = sSQL
    
    cat.Views.Append "Newquery", cd

End Sub

 








Related examples in the same category

1.Creating a View Based on a Table with SQL command
2.Generating a List of Saved Views
3.Deleting a View with SQL command
4.Execute the view