Use ADODB.Command to create a view : ADODB Command « Access « VBA / Excel / Access / Word






Use ADODB.Command to create a view

 
Sub CreateView()
    Dim cmd As ADODB.Command
    Set cmd = New ADODB.Command

    cmd.ActiveConnection = CurrentProject.Connection
    cmd.CommandText = "CREATE VIEW vwClients " & _
        "AS SELECT ClientID, CompanyName " & _
        "FROM Clients"
    cmd.Execute
End Sub

 








Related examples in the same category

1.Command.Execute method
2.Using a Command Object to query table