Make-Table Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi you all!

How do I make a make-table query in VBA code?
I have seen some examples, but they all are like "create table x", "insert
into table x select from..". I'd like to make tables based on queries because
I need to store some calculated data daily. Of course I can make it with SQL
create tables etc, but is there a smarter way?

- Beginner -
 
Hi Beginner

docmd.setwarnings false 'you disable warnings message
docmd.runsql ("SELECT field1, field2 etc. INTO new_tb
FROM datasource") 'datasource is the name of the table or query from which
you wanna pick up the data to put in your new table. In this case the new
table is called new_tb. Field1, Field2 are the names of the fields you wanna
pick up from the datasource. If you wanna take all the fields from the
datasource you can use *
docmd.setwarnings true 'you enable warnings message

HTH Paolo
 
Okay, I'll try that! Thanks, a bit more simple SQL than what I would have
coded :)

- Beginner -
 
Back
Top