Are you trying to do this from Excel VBA or Access VBA?
If Excel VBA, why are you running it from Excel instead of Access?
If from Access VBA, sounds like you want a Make Table Query.
The way I usually go about this is to create an example of a query that does what I want in Access using the Query Builder.
Then, switch the query to SQL View. This shows the SQL code of that query. So that is what the SQL code that you want to create in VBA needs to look like.
Note, typically you would only do it in this way if you query may dynamically change. If it is always the same, you could just create the Make Table Query in Access Query Builder, and run it from there (or call it from a Macro or VBA).