Saving Query result to Table (1 Viewer)

OldManRiver

Registered User.
Local time
Today, 09:02
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
 

chergh

blah
Local time
Today, 15:02
Joined
Jun 15, 2004
Messages
1,414
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
 

WayneRyan

AWF VIP
Local time
Today, 15:02
Joined
Nov 19, 2002
Messages
7,122
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

Top Bottom