Saving Query result to Table

OldManRiver

Registered User.
Local time
Today, 16:00
Joined
Jan 29, 2009
Messages
49
All,

Have working code at:

http://www.access-programmers.co.uk/forums/showthread.php?t=176485

which creates and opens a query. The original query was an append query and I need the same from this query or way to save into table "tblMODfnr".

All HOWTOs and helps I've read, do not show a way to do this and when I click "File" + "SaveAs" with the query open, table is not an option.

How do I get this done?

Do I need to change my SQL to "INSERT INTO" and then "DoCMD.RunSQL"?

Any help appreciated!

Thanks!

OMR
 
Either use "Insert into" if you want the data to be entered into an existing table or use "select into" to create a new table
 
OMR,

If the table exists:

CurrentDb.Execute "Insert Into tblMODfnr Select * From YourQuery"

BUT, the table and query must agree in number of fields and
datatypes. If not:

CurrentDb.Execute "Insert Into tblMODfnr(F1, F2, F3) Select F1, F2, F3 From YourQuery"

If it doesn't exist:

CurrentDb.Execute Select * Into tblMODfnr From YourQuery"

The new table will match your query exactly, but have no PKs, etc.

Wayne
 

Users who are viewing this thread

Back
Top Bottom