create query as sql access vba
Sub CreateQuery()
Dim db As DAO.Database
Dim qDef As DAO.QueryDef
Set db = CurrentDb
Set qDef = db.CreateQueryDef("MyQuery")
qDef.SQL = "SELECT * FROM Vitoshacademy"
qDef.Close
db.Close
Set qDef = Nothing
Set db = Nothing
Application.RefreshDatabaseWindow
End Sub