Run query from VBA code

Let's see how to run a query in Access from VBA code ...

Since we can execute code stored in Access queries with the following syntax in VBA:

DoCmd.OpenQuery " Query Name "

or also directly executing a SQL:

DoCmd.RunSQL " SQL Statements "