Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to copy from query result to table?

Status
Not open for further replies.

xq

Programmer
Jun 26, 2002
106
NL
i've set up several queries and one macro, which will open all the queries i've done, and then i have to write another macro to copy each queries result to each table, but i have no idea of how to copy from query result to table, would be really grateful if anybody could give me a clue!
 
Hi XQ,

Have you tried an append query?

Cheers,

Steve. Make things as simple as possible — but no simpler.
 
Why do you want to put the queries into a table? You can base reports & other queries on these queries so there is usually little point in saving a query as a table.
If, however, you really really want to, then turn the queries into make table queries (look in the help file) and when they run they will copy the results of the query into a new table, but I would think carefully about why you are doing this.

HTH

Ben ----------------------------------------
Ben O'Hara
Home: bpo@SickOfSpam.RobotParade.co.uk
Work: bo104@SickOfSpam.westyorkshire.pnn.police.uk
(in case you've not worked it out get rid of Sick Of Spam to mail me!)
Web: ----------------------------------------
 
thanks! i'm pretty new to access vba, not very clear what i should do right now, but i want to query an sql server database by pass through query, and get the result to compare and update my database. i just thought it might be more safe to copy those data to an temporally table then do the compare things, cos i don't want to change anything in the sql server database. Or the way i'm doing wouldn't help anything?
 
If you really want to save the result of a query as a table, use an append query (as Steve mentioned) or even a Make Table query (which automatically saves the results in a new table).

You can also use the queries you have written as though they were tables as the source for additional queries. I think this is what Ben was refering to.

For example if you want to start with a series of queries to organize your material, then write another query which uses these original queries as input to get your final result, all you would have to do to get your final answer is run the final query. It would force the root queries to be run and you always get current results from the SQL server.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top