Problem in Make-Table Query and associated VBA

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Back
Top