Insert Query to a Table

S

Samantha

Hi,
Is it possible to insert all the fields from a query into a table using SQL
code? For example, I have QueryA with 30 fields, but I don't want to have to
create the table with all 30 identical fields as QueryA. If it is possible,
what would the SQL code be?

I tried the following with only 1 field in table 'Ztest' but it failed.
sql = "INSERT INTO [Ztest] "
sql = sql & " SELECT * FROM qry03PartsOnly"
db.Execute sql, dbFailOnError

Any pointers would help. Thanks in advance.
Samantha
 
J

John Spencer

You can't insert a 30-field table into a 1-field table.

You can use a make table query to create a 30-field table based on a 30-field
table or query.

To use your query, ZTEST would need to have 30 fields that matched up to the
30 fields in qry03PartsOnly.

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 

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