Make-Table Query

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 -
 
G

Guest

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
 
G

Guest

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

- Beginner -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top