Problem in Make-Table Query and associated VBA

G

Guest

Hello,
In a make-table query, the name of the table that is created is located by
following the visual interface steps… Query Design View --> Query -->Make New
Table --> Table Name At this point, the new table's name can be entered
manually. I need to be able to enter the new table name from a form that
also calls the query.

Over in the form, I can call the query with…

DoCmd.openquery “Query_Nameâ€

Using VBA in the Form, how can I specify the Name of the Table to be created?
If this cannot be done in the form, can it be done in the query?

Thank you,

Keith
 
D

Dirk Goldgar

keith said:
Hello,
In a make-table query, the name of the table that is created is
located by following the visual interface steps. Query Design View
--> Query -->Make New Table --> Table Name At this point, the new
table's name can be entered manually. I need to be able to enter the
new table name from a form that also calls the query.

Over in the form, I can call the query with.

DoCmd.openquery "Query_Name"

Using VBA in the Form, how can I specify the Name of the Table to be
created? If this cannot be done in the form, can it be done in the
query?

You have to modify the SQL of the query to put a different table name
after the keyword "INTO". It's certainly doable, but if you're going to
be changing the table name every time you run the query, you may want to
build and execute the SQL statement entirely in code, rather than
modifying the SQL of a stored query.
 

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